[Haskell-cafe] Associated patterns

Alejandro Serrano Mena trupill at gmail.com
Tue Jan 21 10:31:39 UTC 2014


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/d02706e7/attachment.html>


More information about the Haskell-Cafe mailing list