
'$' has the same effect as parens around whatever's after it so 'Left
$ A x' == 'Left (A x)'. Since Haskell is left associative 'Left A x'
== '(Left A) x' which is wrong and gives me a compile error.
And yes it has the same effect as putStrLn $ "welcome".
-deech
On Wed, Dec 15, 2010 at 8:15 AM, Guofeng Zhang
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?
On Wed, Dec 15, 2010 at 4:26 AM, Russ Abbott
wrote: Isn't "Either" the same thing as AorB in
data AorB = Aconstructor Int | Bconstructor Int
I want two separate types A and B along with a third type which is their Union. Is that not possible? In my actual case, I have more than two types. So I would like a way to take the union of an arbitrarily number of types.
data Union = A1 | A2 | ...
where each of A1, A2, ... has its own data declaration.
-- Russ
On Tue, Dec 14, 2010 at 12:14 PM, Tobias Brandt
wrote: data AorB = Aconstructor Int | Bconstructor Int
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners