diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2018-08-06 12:53:06 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-08-07 15:56:53 -0400 |
commit | aab8656ba0561e56048a1222c396d2d117aca5a7 (patch) | |
tree | 8d14345e7f042ba5700b4275950e44dcc0ca1be9 /compiler/deSugar/Coverage.hs | |
parent | f22baa424aed66cd75ea05d4db7efdcd0e021217 (diff) | |
download | haskell-aab8656ba0561e56048a1222c396d2d117aca5a7.tar.gz |
Turn on MonadFail desugaring by default
Summary:
This contains two commits:
----
Make GHC's code-base compatible w/ `MonadFail`
There were a couple of use-sites which implicitly used pattern-matches
in `do`-notation even though the underlying `Monad` didn't explicitly
support `fail`
This refactoring turns those use-sites into explicit case
discrimations and adds an `MonadFail` instance for `UniqSM`
(`UniqSM` was the worst offender so this has been postponed for a
follow-up refactoring)
---
Turn on MonadFail desugaring by default
This finally implements the phase scheduled for GHC 8.6 according to
https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail#Transitionalstrategy
This also preserves some tests that assumed MonadFail desugaring to be
active; all ghc boot libs were already made compatible with this
`MonadFail` long ago, so no changes were needed there.
Test Plan: Locally performed ./validate --fast
Reviewers: bgamari, simonmar, jrtc27, RyanGlScott
Reviewed By: bgamari
Subscribers: bgamari, RyanGlScott, rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D5028
Diffstat (limited to 'compiler/deSugar/Coverage.hs')
-rw-r--r-- | compiler/deSugar/Coverage.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/deSugar/Coverage.hs b/compiler/deSugar/Coverage.hs index b5c18e5d66..99ba96755f 100644 --- a/compiler/deSugar/Coverage.hs +++ b/compiler/deSugar/Coverage.hs @@ -292,11 +292,15 @@ addTickLHsBind (L pos (funBind@(FunBind { fun_id = (L _ id) }))) = do tickish <- tickishType `liftM` getEnv if inline && tickish == ProfNotes then return (L pos funBind) else do - (fvs, mg@(MG { mg_alts = matches' })) <- + (fvs, mg) <- getFreeVars $ addPathEntry name $ addTickMatchGroup False (fun_matches funBind) + case mg of + MG {} -> return () + _ -> panic "addTickLHsBind" + blackListed <- isBlackListed pos exported_names <- liftM exports getEnv @@ -315,7 +319,7 @@ addTickLHsBind (L pos (funBind@(FunBind { fun_id = (L _ id) }))) = do return Nothing let mbCons = maybe Prelude.id (:) - return $ L pos $ funBind { fun_matches = mg { mg_alts = matches' } + return $ L pos $ funBind { fun_matches = mg , fun_tick = tick `mbCons` fun_tick funBind } where |