[project @ 2002-05-09 13:16:29 by simonmar]
[ghc-base.git] / Data / Either.hs
index ea91a48..d8a35b5 100644 (file)
@@ -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