summaryrefslogtreecommitdiff
path: root/compiler/deSugar/DsUtils.hs
diff options
context:
space:
mode:
authorPeter Wortmann <scpmw@leeds.ac.uk>2014-01-09 19:12:30 +0000
committerAustin Seipp <austin@well-typed.com>2014-12-16 15:01:57 -0600
commit3b893f386b086a6cbac81d277a5aceaf1ee39e42 (patch)
treea0a8c9b14183be56e20a36d41c718092d666c1ee /compiler/deSugar/DsUtils.hs
parent993975d3a532887b38618eb604efe6502f3c66f8 (diff)
downloadhaskell-3b893f386b086a6cbac81d277a5aceaf1ee39e42.tar.gz
Generalized Coverage pass to allow adding multiple types of Tickishs
This allows having, say, HPC ticks, automatic cost centres and source notes active at the same time. We especially take care to un-tangle the infrastructure involved in generating them. (From Phabricator D169)
Diffstat (limited to 'compiler/deSugar/DsUtils.hs')
-rw-r--r--compiler/deSugar/DsUtils.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler/deSugar/DsUtils.hs b/compiler/deSugar/DsUtils.hs
index 1a7985fec3..f94b831a6f 100644
--- a/compiler/deSugar/DsUtils.hs
+++ b/compiler/deSugar/DsUtils.hs
@@ -599,7 +599,7 @@ cases like
(p,q) = e
-}
-mkSelectorBinds :: [Maybe (Tickish Id)] -- ticks to add, possibly
+mkSelectorBinds :: [[Tickish Id]] -- ticks to add, possibly
-> LPat Id -- The pattern
-> CoreExpr -- Expression to which the pattern is bound
-> DsM [(Id,CoreExpr)]
@@ -650,7 +650,7 @@ mkSelectorBinds ticks pat val_expr
; return ( (tuple_var, tuple_expr) : zipWith mk_tup_bind ticks' binders ) }
where
binders = collectPatBinders pat
- ticks' = ticks ++ repeat Nothing
+ ticks' = ticks ++ repeat []
local_binders = map localiseId binders -- See Note [Localise pattern binders]
local_tuple = mkBigCoreVarTup binders
@@ -807,9 +807,8 @@ CPR-friendly. This matters a lot: if you don't get it right, you lose
the tail call property. For example, see Trac #3403.
-}
-mkOptTickBox :: Maybe (Tickish Id) -> CoreExpr -> CoreExpr
-mkOptTickBox Nothing e = e
-mkOptTickBox (Just tickish) e = Tick tickish e
+mkOptTickBox :: [Tickish Id] -> CoreExpr -> CoreExpr
+mkOptTickBox = flip (foldr Tick)
mkBinaryTickBox :: Int -> Int -> CoreExpr -> DsM CoreExpr
mkBinaryTickBox ixT ixF e = do