on master help sign in
Merge pull request #1504 from Heather/eithererr

EitherErr Applicative for Functor-Applicative-Monad_Proposal

commit134dbf878b3a4137fba108798d3d2d6629813a04 authorDavid Christiansen <david@davidchristiansen.dk> dateTue 2 Sep 2014, 08:58 (12 years ago) parentc64f2c2e071c68
1 file changed+6−1
src/Idris/AbsSyntax.hs+6−1
src/Idris/AbsSyntax.hs+6−1
@@ -17,6 +17,7 @@ import Util.DynamicLinker
1717import System.Console.Haskeline
1818import System.IO
1919
20+import Control.Applicative
2021import Control.Monad.State
2122import Control.Monad.Error(throwError)
2223
@@ -1663,7 +1664,11 @@ findStatics ist tm = trace (show tm) $
16631664 pos ns ss t = return t
16641665
16651666-- for 6.12/7 compatibility
1666−data EitherErr a b = LeftErr a | RightOK b
1667+data EitherErr a b = LeftErr a | RightOK b deriving ( Functor )
1668+
1669+instance Applicative (EitherErr a) where
1670+ pure = return
1671+ (<*>) = ap
16671672
16681673instance Monad (EitherErr a) where
16691674 return = RightOK