logo       

Re: Union Types for Haskell!?: msg#00080

lang.haskell.general

Subject: Re: Union Types for Haskell!?

Hi Bernd,

> data B = ...
> data C = ...
> type A = B | C | D -- A accepts values of either B or C or D (cf. the
> "Either a" type in the Prelude)

What about the construction of a union type in Haskell like this?:

data B = B1 | B2
data C = C1 | C2 | C3
data D = D1 | D2
data A = UB B | UC C | UD D -- here's the union type

For instance a list of type [A] may look like this: [UB B1,UC C2,UC C1,UD D1]

Christian







<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise