Preparing for a review of pattern synonyms
Dr. ERDI Gergo
gergo at erdi.hu
Tue Dec 10 12:11:14 UTC 2013
On Mon, 9 Dec 2013, Simon Marlow wrote:
>> 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.
OK, I'll add pattern synonym support for Haddock. We don't really have a
surface syntax for pattern types (yet?), so for now I'll just use this
format:
pattern P :: b -> a -> T a; requires (Num a); provides (Eq b)
> 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!
This should be something orthogonal to pattern synonyms that supports
regular view patterns as well.
>> If there's no separate Trac ticket for ViewPatternsAlternative yet, I'm
>> happy to open one.
>
> That would be great!
I've added it as #8605.
Bye,
Gergo
--
.--= ULLA! =-----------------.
\ http://gergo.erdi.hu \
`---= gergo at erdi.hu =-------'
Ölni tudnék egy Nobel-békedíjért.
More information about the ghc-devs
mailing list