Future-proof the TC' monad
In GHC 7.10 Monad instances will need to implement Applicative
and MonadPlus instances Alternative.
Just reuse the corresponding functions on the Monad/MonadPlus instances.
Fixes #1181
commit30ee9ad33c8413a4155b04e54caad307b6cc8310
authorniklas <niklas@mm.st>
dateMon 5 May 2014, 18:53 (12 years ago)
parent304fff1
src/Idris/Core/TC.hs+9
@@ -2,6 +2,7 @@
22
33module Idris.Core.TC(TC'(..)) where
44
5+import Control.Applicative
56import Control.Monad
67import Control.Monad.Trans.Error(Error(..))
78
@@ -26,3 +27,11 @@ instance Error e => MonadPlus (TC' e) where
2627 _ `mplus` (OK y) = OK y
2728 err `mplus` _ = err
2829
30+
31+instance Error e => Applicative (TC' e) where
32+ pure = return
33+ (<*>) = ap
34+
35+instance Error e => Alternative (TC' e) where
36+ empty = mzero
37+ (<|>) = mplus