[GHC] #10653: PatternSynonyms should be imported/exported as part of the wildcard notation
GHC
ghc-devs at haskell.org
Mon Sep 14 07:56:24 UTC 2015
#10653: PatternSynonyms should be imported/exported as part of the wildcard
notation
-------------------------------------+-------------------------------------
Reporter: gridaphobe | Owner: mpickering
Type: feature request | Status: new
Priority: high | Milestone: 8.0.1
Component: Compiler | Version: 7.11
Resolution: | Keywords: pattern
| synonyms
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by simonpj):
Thanks for the wiki page. But before implementing anything, can you make
it a proposed ''specification'' rather than a general idea illustrated by
an example or two?
Notably:
* When, precisely, is it OK to export `T( P )`, where `P` is a pattern
synonym?
* What, precisely, is exported by `T(..)`?
To give you the idea, the
[https://www.haskell.org/onlinereport/haskell2010/haskellch5.html#x11-1000005.2
current spec is here].
I think it's important that one can answer these questions without doing
type checking. (In implementation terms, the renamer has to answer these
questions, and typechecking has not happened yet.)
I think your answers will say something like this. Given
{{{
pattern P xs = C p1 p2
}}}
where `C` is a data constructor, then `T( P )` is a valid export item iff
(a) `C` is a data constructor from data type `T`, and (b) `P` is in scope.
It does not matter whether or not `C` is in scope (correct?).
But it gets more complicated if `C` is itself a pattern synonym; or,
worse, if it is a view pattern. Maybe it's driven off the pattern
signature, if there is one?
You might find it helpful first to define the notion of "a pattern synonym
`P` ''belongs to'' a data type `T`".
Anyway, a specification is badly needed!
Simon
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10653#comment:20>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list