summaryrefslogtreecommitdiff
path: root/compiler/utils
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils')
-rw-r--r--compiler/utils/IOEnv.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
index 583e875903..04c11cf531 100644
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -42,6 +42,7 @@ import System.IO.Unsafe ( unsafeInterleaveIO )
import System.IO ( fixIO )
import Control.Monad
import MonadUtils
+import Control.Applicative (Alternative(..))
----------------------------------------------------------------------
-- Defining the monad type
@@ -150,9 +151,13 @@ unsafeInterleaveM (IOEnv m) = IOEnv (\ env -> unsafeInterleaveIO (m env))
----------------------------------------------------------------------
--- MonadPlus
+-- Alternative/MonadPlus
----------------------------------------------------------------------
+instance MonadPlus IO => Alternative (IOEnv env) where
+ empty = mzero
+ (<|>) = mplus
+
-- For use if the user has imported Control.Monad.Error from MTL
-- Requires UndecidableInstances
instance MonadPlus IO => MonadPlus (IOEnv env) where