X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FEither.hs;h=d8a35b57a912a1b4bdbb2544d741e46e5d21bce5;hb=f7a485978f04e84b086f1974b88887cc72d832d0;hp=ea91a48da45b348193cf6e4e0f24357c46d9e83e;hpb=5545727d5a6a1fc6d5d00f32a92a8fdf0fb7ca77;p=ghc-base.git diff --git a/Data/Either.hs b/Data/Either.hs index ea91a48..d8a35b5 100644 --- a/Data/Either.hs +++ b/Data/Either.hs @@ -1,16 +1,14 @@ {-# OPTIONS -fno-implicit-prelude #-} ----------------------------------------------------------------------------- --- +-- | -- Module : Data.Either -- Copyright : (c) The University of Glasgow 2001 --- License : BSD-style (see the file libraries/core/LICENSE) +-- License : BSD-style (see the file libraries/base/LICENSE) -- -- Maintainer : libraries@haskell.org -- Stability : experimental -- Portability : portable -- --- $Id: Either.hs,v 1.2 2001/07/03 11:37:49 simonmar Exp $ --- -- The Either type, and associated operations. -- ----------------------------------------------------------------------------- @@ -21,5 +19,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