diff options
author | David Luposchainsky <dluposchainsky@gmail.com> | 2015-11-17 17:10:02 +0100 |
---|---|---|
committer | Ben Gamari <bgamari.foss@gmail.com> | 2015-11-17 12:29:09 -0500 |
commit | 233d1312bf15940fca5feca6884f965e7944b555 (patch) | |
tree | 0f787688562e65c1043626d8d03447ef2ab0b7a7 /compiler/types/Unify.hs | |
parent | 7b962bab384e2ae85b41d30f503c3d0295b0214f (diff) | |
download | haskell-233d1312bf15940fca5feca6884f965e7944b555.tar.gz |
MonadFail proposal, phase 1
This implements phase 1 of the MonadFail proposal (MFP, #10751).
- MonadFail warnings are all issued as desired, tunable with two new flags
- GHC was *not* made warning-free with `-fwarn-missing-monadfail-warnings`
(but it's disabled by default right now)
Credits/thanks to
- Franz Thoma, whose help was crucial to implementing this
- My employer TNG Technology Consulting GmbH for partially funding us
for this work
Reviewers: goldfire, austin, #core_libraries_committee, hvr, bgamari, fmthoma
Reviewed By: hvr, bgamari, fmthoma
Subscribers: thomie
Projects: #ghc
Differential Revision: https://phabricator.haskell.org/D1248
GHC Trac Issues: #10751
Diffstat (limited to 'compiler/types/Unify.hs')
-rw-r--r-- | compiler/types/Unify.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/types/Unify.hs b/compiler/types/Unify.hs index 87681e0eb8..a29c85f2da 100644 --- a/compiler/types/Unify.hs +++ b/compiler/types/Unify.hs @@ -34,6 +34,9 @@ import Outputable import FastString (sLit) import Control.Monad (liftM, foldM, ap) +#if __GLASGOW_HASKELL__ > 710 +import qualified Control.Monad.Fail as MonadFail +#endif #if __GLASGOW_HASKELL__ < 709 import Control.Applicative (Applicative(..)) #endif @@ -729,6 +732,11 @@ instance Monad UM where other -> other SurelyApart -> SurelyApart) +#if __GLASGOW_HASKELL__ > 710 +instance MonadFail.MonadFail UM where + fail _ = UM (\_tvs _subst -> SurelyApart) -- failed pattern match +#endif + -- returns an idempotent substitution initUM :: (TyVar -> BindFlag) -> UM () -> UnifyResult initUM badtvs um = fmap (niFixTvSubst . snd) $ unUM um badtvs emptyTvSubstEnv |