This is a very simple datatype. Either3 a b c holds either an a, or a b, or a c.
Create Either3 values:
GHCi, version 7.10.2: http://www.haskell.org/ghc/ :? for help
Prelude> import Data.Either3
Prelude Data.Either3> let x :: Either3 Int Float Double; x = First 5
Prelude Data.Either3> let y :: Either3 Int Float Double; y = Second 5.12
Query their type:
Prelude Data.Either3> :type x
x :: Either3 Int Float Double
Prelude Data.Either3> :type y
y :: Either3 Int Float Double
Prelude Data.Either3> isFirst x
True
Prelude Data.Either3> isFirst y
False
Extract information:
Prelude Data.Either3> 5 + either3 fromIntegral realToFrac id x
10.0
Prelude Data.Either3> :type (5 + either3 fromIntegral realToFrac id x)
(5 + either3 fromIntegral realToFrac id x) :: Double