[Haskell-cafe] Datatypes - Haskell

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sat Feb 9 19:28:54 EST 2008


On Feb 9, 2008, at 19:09 , Mattes Simeon wrote:

> e.g. data Pair a b = Pair a b

struct Pair { a pair_a; b pair_b; };

> data Either a b = Left a | Right b

union Either { enum { Left, Right } _tag; a either_left; b  
either_right; };
(except that Haskell makes sure you use it properly, while C will let  
you access foo.either_right when foo._tag == Left).

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH




More information about the Haskell-Cafe mailing list