summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore/Utils.hs
diff options
context:
space:
mode:
authorArtyom Kuznetsov <hi@wzrd.ht>2021-07-29 12:10:29 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-08-10 15:00:42 -0400
commit130f94dbd3536bd409621cbaac4659ababf613b3 (patch)
tree55809a2f6f91bfecadcc6a1ef7d4f3895cc6c253 /compiler/GHC/HsToCore/Utils.hs
parent741fdf0e4f371afbd8ef36f81bbb90a2049b005c (diff)
downloadhaskell-130f94dbd3536bd409621cbaac4659ababf613b3.tar.gz
Refactor HsStmtContext and remove HsDoRn
Parts of HsStmtContext were split into a separate data structure HsDoFlavour. Before this change HsDo used to have HsStmtContext inside, but in reality only parts of HsStmtContext were used and other cases were invariants handled with panics. Separating those parts into its own data structure helps us to get rid of those panics as well as HsDoRn type family.
Diffstat (limited to 'compiler/GHC/HsToCore/Utils.hs')
-rw-r--r--compiler/GHC/HsToCore/Utils.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/GHC/HsToCore/Utils.hs b/compiler/GHC/HsToCore/Utils.hs
index 333929c956..c1426474be 100644
--- a/compiler/GHC/HsToCore/Utils.hs
+++ b/compiler/GHC/HsToCore/Utils.hs
@@ -956,7 +956,7 @@ CPR-friendly. This matters a lot: if you don't get it right, you lose
the tail call property. For example, see #3403.
-}
-dsHandleMonadicFailure :: HsStmtContext GhcRn -> LPat GhcTc -> MatchResult CoreExpr -> FailOperator GhcTc -> DsM CoreExpr
+dsHandleMonadicFailure :: HsDoFlavour -> LPat GhcTc -> MatchResult CoreExpr -> FailOperator GhcTc -> DsM CoreExpr
-- In a do expression, pattern-match failure just calls
-- the monadic 'fail' rather than throwing an exception
dsHandleMonadicFailure ctx pat match m_fail_op =
@@ -977,9 +977,9 @@ dsHandleMonadicFailure ctx pat match m_fail_op =
fail_expr <- dsSyntaxExpr fail_op [fail_msg]
body fail_expr
-mk_fail_msg :: DynFlags -> HsStmtContext GhcRn -> LocatedA e -> String
+mk_fail_msg :: DynFlags -> HsDoFlavour -> LocatedA e -> String
mk_fail_msg dflags ctx pat
- = showPpr dflags $ text "Pattern match failure in" <+> pprStmtContext ctx
+ = showPpr dflags $ text "Pattern match failure in" <+> pprHsDoFlavour ctx
<+> text "at" <+> ppr (getLocA pat)
{- Note [Desugaring representation-polymorphic applications]