lude

Haskell prelude alternative
git clone git://git.rr3.xyz/lude | git clone gits://git.rr3.xyz/lude
Log | Files | Refs | README | LICENSE

Either.hs (635B)


      1 module Lude.Either (
      2     Either (..),
      3     type (+),
      4     --
      5     Either1 (..),
      6     type (+^),
      7 ) where
      8 
      9 import Lude.Haskell
     10 
     11 -- TODO: It's probably not worth defining our own type here.
     12 
     13 --------------------------------------------------------------------------------
     14 
     15 type Either :: Type -> Type -> Type
     16 data Either a b = L a | R b
     17 
     18 type (+) = Either
     19 infixl 6 +
     20 
     21 --------------------------------------------------------------------------------
     22 
     23 type Either1 :: forall i j. Type1 i -> Type1 j -> Type1 (i + j)
     24 data Either1 f g a where
     25     L1 :: f a -> Either1 f g (L a)
     26     R1 :: g a -> Either1 f g (R a)
     27 
     28 type (+^) = Either1
     29 infixl 6 +^