[PRL] IOP and disjoint unions

Paul A. Steckler steck at stecksoft.com
Fri Apr 29 13:43:01 EDT 2005


> Somewhat more concretely, in set theory disjoint union is usually 
> encoded using a "tag" to distinguish between the two cases:

Even more concretely, Haskell has a type constructor
named Either, of kind * -> * -> *.  The type 
Either t1 t2 corresponds to the co-product
t1 + t2.  The corresponding term constructors are 

  Left :: a -> Either a b
  Right :: b -> Either a b

It's sensible to have an object of type, say, Either Int Int, 
where your program treats a Left 42 differently than 
a Right 42 -- and both of these differently than a vanilla 
42 of type Int.

-- Paul



More information about the PRL mailing list