[Haskell-beginners] Type unions

Guofeng Zhang guofengzh at gmail.com
Wed Dec 15 15:15:16 CET 2010


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 <russ.abbott at gmail.com> 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 <tob.brandt at googlemail.com
> > wrote:
>
>> data AorB = Aconstructor Int | Bconstructor Int
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20101215/031eeb0b/attachment.htm>


More information about the Beginners mailing list