[Haskell-cafe] MultiCase alternative

Baa aquagnu at gmail.com
Fri Jun 16 09:58:06 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.
> 

Aha, I checked it, good.


More information about the Haskell-Cafe mailing list