summaryrefslogtreecommitdiff
path: root/compiler/utils/Exception.hs
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2015-10-17 16:47:51 +0200
committerBen Gamari <ben@smart-cactus.org>2015-10-17 16:51:33 +0200
commite8ed2136feea75f4676eb6103acd5bb1bfe35281 (patch)
tree156daa80421dfdd923d3fa12c83809458f42d333 /compiler/utils/Exception.hs
parent40cbf9aaa16fd263c54e159a4bda3a5682720041 (diff)
downloadhaskell-e8ed2136feea75f4676eb6103acd5bb1bfe35281.tar.gz
Make Monad/Applicative instances MRP-friendly
This patch refactors pure/(*>) and return/(>>) in MRP-friendly way, i.e. such that the explicit definitions for `return` and `(>>)` match the MRP-style default-implementation, i.e. return = pure and (>>) = (*>) This way, e.g. all `return = pure` definitions can easily be grepped and removed in GHC 8.1; Test Plan: Harbormaster Reviewers: goldfire, alanz, bgamari, quchen, austin Reviewed By: quchen, austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1312
Diffstat (limited to 'compiler/utils/Exception.hs')
-rw-r--r--compiler/utils/Exception.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/utils/Exception.hs b/compiler/utils/Exception.hs
index 850393e359..8168992e00 100644
--- a/compiler/utils/Exception.hs
+++ b/compiler/utils/Exception.hs
@@ -6,6 +6,7 @@ module Exception
)
where
+import Control.Applicative as A
import Control.Exception
import Control.Monad.IO.Class
@@ -28,7 +29,7 @@ tryIO = try
-- implementations of 'gbracket' and 'gfinally' use 'gmask'
-- thus rarely require overriding.
--
-class MonadIO m => ExceptionMonad m where
+class (A.Applicative m, MonadIO m) => ExceptionMonad m where
-- | Generalised version of 'Control.Exception.catch', allowing an arbitrary
-- exception handling monad instead of just 'IO'.