X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FEither.hs;h=20dfe47ef5f745ed7b8d0a28dec615fac03e4ed8;hb=d9e5fa673b75cdffbcd0e85cdcc98d706acbb29a;hp=f3cd10665590c3bac229e32e91231d52c4f46b3c;hpb=7f1f4e7a695c402ddd3a1dc2cc7114e649a78ebc;p=ghc-base.git diff --git a/Data/Either.hs b/Data/Either.hs index f3cd106..20dfe47 100644 --- a/Data/Either.hs +++ b/Data/Either.hs @@ -7,9 +7,9 @@ -- -- Maintainer : libraries@haskell.org -- Stability : experimental --- Portability : non-portable +-- Portability : portable -- --- $Id: Either.hs,v 1.1 2001/06/28 14:15:02 simonmar Exp $ +-- $Id: Either.hs,v 1.3 2001/07/03 14:13:32 simonmar Exp $ -- -- The Either type, and associated operations. -- @@ -21,5 +21,11 @@ module Data.Either ( ) where #ifdef __GLASGOW_HASKELL__ -import GHC.Maybe +import GHC.Base #endif + +data Either a b = Left a | Right b deriving (Eq, Ord ) + +either :: (a -> c) -> (b -> c) -> Either a b -> c +either f _ (Left x) = f x +either _ g (Right y) = g y