[Haskell-cafe] MultiCase alternative

Brandon Allbery allbery.b at gmail.com
Fri Jun 16 09:50:48 UTC 2017

On Fri, Jun 16, 2017 at 2:21 AM, <ok at cs.otago.ac.nz> wrote:

> If you write instead
> data D a b c d = D { f1 :: a, f2 :: b, f3 :: c, f4 :: d }
> then you can abbreviate patterns like this:
> f (D{}) = ()

As a special case, you can use the no-fields record pattern Cons {} with
*any* constructor, regardless of whether it was defined with record syntax
or whether it has parameters.

brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170616/0f2c097f/attachment.html>

More information about the Haskell-Cafe mailing list