Proposal: pattern synonyms

Niklas Broberg niklas.broberg at gmail.com
Fri Feb 17 06:48:08 EST 2006


> Most of this discussion on patterns (except for views)
> seems too much focused on concrete data types.
> (regexps for lists: what a horrible thought :-)
> This is just the thing to avoid in software design.
> (Don't expose implementation details, use interfaces etc.)

There's nothing in HaRP that would not work seamlessly with any
sequential datatype through an interface of destructors, and clearly
that's the Right (TM) way to go. The current implementation is just
proof of concept. :-)

IMO your comment only further speaks for my proposal to add guards to
pattern synonyms. With an interface of destructors, you could define
patterns that don't say anything about the underlying implementation,
e.g.

Head x = xs | x <- head xs

where the head function comes from some interface for sequences. This
is not something that can be done currently, nor with the initial
proposal for pattern synonyms.

/Niklas


More information about the Haskell-prime mailing list