On 09/12/2013 13:31, Dr. ERDI Gergo wrote:
Hi Simon,
On Mon, 9 Dec 2013, Simon Marlow wrote:
I think pattern synonyms are great! A couple of questions:
* what will Haddock show for a pattern export?
Is Haddock a part of GHC? I don't know. If it's not, then whatever
parser it's using will have to be extended to support pattern synonyms.
Haddock uses GHC's parser, but it will need to be taught about pattern
synonyms and how to render them in documentation.
* can we still write pattern matches that GHC can infer
to be exhaustive when using pattern synonyms?
No. I don't see how that would be possible without having access to the
pattern synonym definition when typechecking/compiling a use site. One
deliberate design decision was to make pattern synonyms proper
abstractions, in the sense that compiling use sites shouldn't require
access to its definition details.
Right, I'm not suggesting that we should break the abstraction, but I
think it would be really nice if there was a way to say "the following 3
patterns are exhaustive", perhaps in a pragma.
One of the things that we ought to be able to do with this extension is
to provide abstract datatypes with pattern matching support. The only
thing missing is support for exhaustive pattern matches. F# active
patterns has it!
Are we not doing ViewPatternsAlternative any more?
https://ghc.haskell.org/trac/ghc/wiki/ViewPatternsAlternative
Or is that just being treated as an orthogonal issue? I rather like
that proposal, and we originally discussed it in conjunction with
pattern synonyms.
It should be treated as orthogonal -- if and when GHC gets support for
it, they will be available in PatternSynonyms as well.
If there's no separate Trac ticket for ViewPatternsAlternative yet, I'm
happy to open one.
That would be great!
Cheers,
Simon
_______________________________________________
ghc-devs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-devs