[Haskell-cafe] Associated patterns

Carter Schonwald carter.schonwald at gmail.com
Tue Jan 21 17:17:18 UTC 2014


It's been merged in, so you should build head and find out! (Seriously,
we're very close to an official RC, if you use a unixy platform current
head should look very similar to the official RC)

On Tuesday, January 21, 2014, Alejandro Serrano Mena <trupill at gmail.com>
wrote:

> Dear haskell-cafe,
> I've read in Reddit that pattern synonyms have been merged in GHC HEAD [
> http://www.reddit.com/r/haskell/comments/1vpaey/pattern_synonyms_merged_into_ghchead/
> ].
>
> I would like to know whether associated patterns, that is, patterns which
> come under the umbrella of a type class, have also been implemented.
>
> I think that associated patterns would fill the gap in difference of
> features between type classes and common data types. For plain data types,
> you can declare both functions and patterns (either via constructors or now
> via pattern synonyms). However, you can only declare functions (either
> term-level or type-level) in type classes. This means that the pattern
> match mechanism, very useful to get clear code, is not useful if you want
> to use type classes.
>
> Alejandro.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140121/8870dafb/attachment.html>


More information about the Haskell-Cafe mailing list