[Haskell-beginners] Type unions
Thomas Davie
tom.davie at gmail.com
Wed Dec 15 15:20:41 CET 2010
On 15 Dec 2010, at 14:15, Guofeng Zhang wrote:
> What does "$" mean in Left $ A x. Why does not write it as "Left A x"?
>
> For putStrLn $ "welcome", is the "$" has the same meaning as that in Left $ A x?
It's an infix operator that does nothing but applies the thing on the left to the thing on the right.
The reason it's needed is because Left A x would be parsed as (Left applied to A) applied to x, wheras what we want is Left applied to (A applied to x).
This can also be done with parentheses, but is often nicer done with $.
Bob
More information about the Beginners
mailing list