summaryrefslogtreecommitdiff
path: root/compiler/utils/MonadUtils.hs
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2016-01-01 01:45:08 +0100
committerHerbert Valerio Riedel <hvr@gnu.org>2016-01-01 01:55:16 +0100
commitdafeb51f266793a67e8ae18ae39a2e2e87943824 (patch)
treef1ef3abd7fc655e6b8896a6841f0efd9a39a39fe /compiler/utils/MonadUtils.hs
parent8afeaad919dc67643b4eff14efafb48b59039b2b (diff)
downloadhaskell-dafeb51f266793a67e8ae18ae39a2e2e87943824.tar.gz
Canonicalise `MonadPlus` instances
This refactoring exploits the fact that since AMP, in most cases, `instance MonadPlus` can be automatically derived from the respective `Alternative` instance. This is because `MonadPlus`'s default method implementations are fully defined in terms of `Alternative(empty, (<>))`.
Diffstat (limited to 'compiler/utils/MonadUtils.hs')
-rw-r--r--compiler/utils/MonadUtils.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/utils/MonadUtils.hs b/compiler/utils/MonadUtils.hs
index 36eb574e78..af4f0253db 100644
--- a/compiler/utils/MonadUtils.hs
+++ b/compiler/utils/MonadUtils.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
-- | Utilities related to Monad and Applicative classes
-- Mostly for backwards compatability.
@@ -30,11 +31,12 @@ module MonadUtils
import Maybes
-import Control.Applicative
import Control.Monad
import Control.Monad.Fix
import Control.Monad.IO.Class
-import Prelude -- avoid redundant import warning due to AMP
+#if __GLASGOW_HASKELL__ < 800
+import Control.Monad.Trans.Error () -- for orphan `instance MonadPlus IO`
+#endif
-------------------------------------------------------------------------------
-- Lift combinators