General pattern bindings
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Mon Apr 16 07:04:01 EDT 2007
Twan van Laarhoven <twanvl at gmail.com> wrote:
> > The general form of a pattern binding is p match, where a match is
> > the same structure as for function bindings above; in other words,
> > a pattern binding is:
> >
> > p | g1 = e1
> > | g2 = e2
> > ...
> > | gm = em
> > where { decls }
>
> I did not even know these things existed, is there anyone who actually
> uses general pattern bindings?
It is worth mentioning that such pattern bindings are not only used at
the top-level - they are also valid in local definitions, where the
guards may involve variables bound at an outer scope. This makes them
highly useful.
Regards,
Malcolm
More information about the Haskell-prime
mailing list