[GHC] #4095: add Applicative instance for Either

GHC cvs-ghc at haskell.org
Tue May 25 08:37:25 EDT 2010


#4095: add Applicative instance for Either
---------------------------------+------------------------------------------
    Reporter:  ross              |       Owner:                
        Type:  proposal          |      Status:  new           
    Priority:  normal            |   Component:  libraries/base
     Version:  6.12.2            |    Keywords:                
          Os:  Unknown/Multiple  |    Testcase:                
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown  
---------------------------------+------------------------------------------
 The proposal is to add this instance to Control.Applicative:
 {{{
 instance Applicative (Either e) where
         pure          = Right
         Left  e <*> _ = Left e
         Right f <*> r = fmap f r
 }}}
 This is not the only possible instance for Either, but this one is
 compatible with the usual Monad instance.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4095>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list