[Haskell-beginners] Applicative instance for Either String

Michael Mossey mpm at alumni.caltech.edu
Sat Jul 17 05:15:47 EDT 2010


Why does the following give me an error unless I enable FlexibleInstances?

instance Applicative (Either String) where
   pure x = Right x
   Right g <*> Right x = Right (g x)
   Right _ <*> Left s = Left s
   Left s <*> _ = Left s


More information about the Beginners mailing list