1 {-# OPTIONS -fno-implicit-prelude #-}
2 -----------------------------------------------------------------------------
4 -- Module : Data.Either
5 -- Copyright : (c) The University of Glasgow 2001
6 -- License : BSD-style (see the file libraries/core/LICENSE)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : experimental
10 -- Portability : portable
12 -- $Id: Either.hs,v 1.3 2001/07/03 14:13:32 simonmar Exp $
14 -- The Either type, and associated operations.
16 -----------------------------------------------------------------------------
20 either -- :: (a -> c) -> (b -> c) -> Either a b -> c
23 #ifdef __GLASGOW_HASKELL__
27 data Either a b = Left a | Right b deriving (Eq, Ord )
29 either :: (a -> c) -> (b -> c) -> Either a b -> c
30 either f _ (Left x) = f x
31 either _ g (Right y) = g y