[Haskell-beginners] pattern matching on a common element
briand at aracnet.com
briand at aracnet.com
Fri Nov 25 20:50:01 UTC 2016
On Fri, 25 Nov 2016 18:18:21 +0100
Daniel Trstenjak <daniel.trstenjak at gmail.com> wrote:
> Hi Brian,
>
> > interestingly in my journeys through the intertubes I have not found a
> > single mention of using the "()" syntax in place of the
> > "{fieldname=value, ...}" syntax as the generator.
>
> The '()' isn't part of the 'data constructor' (the usual term for A1/A2/A3),
> but sometimes needed to help the compiler to make an unambiguous parsing of the expression.
>
> These are all valid expressions:
>
> i $ A1 "foo" 3.2 -- '$' is often used to get rid of parentheses
>
> let a1 = A1 "foo" 3.2 in i a1
>
oh, i see. everything's a function.
thanks!
Brian
More information about the Beginners
mailing list