[project @ 1998-12-02 13:17:09 by simonm]
[ghc-hetmet.git] / ghc / lib / std / PrelEither.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1997
3 %
4 \section[PrelEither]{Module @PrelEither@}
5
6 The @Either@ Type.
7
8 \begin{code}
9 {-# OPTIONS -fno-implicit-prelude #-}
10
11 module PrelEither where
12
13 import PrelBase
14
15 data  Either a b  =  Left a | Right b   deriving (Eq, Ord, Show {- Read -} )
16
17 either                  :: (a -> c) -> (b -> c) -> Either a b -> c
18 either f g (Left x)     =  f x
19 either f g (Right y)    =  g y
20 \end{code}