summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreSyn.hs
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2017-03-29 16:08:40 -0400
committerBen Gamari <ben@smart-cactus.org>2017-03-29 16:08:45 -0400
commit04ea4c3f86db4e2cc7b2683f58f2076233039ebf (patch)
tree08e034753aaeca0fff496b5f7f0832fac149b7e1 /compiler/coreSyn/CoreSyn.hs
parent5856c564dff79a5c2b6a92b1c6c350798b538da3 (diff)
downloadhaskell-04ea4c3f86db4e2cc7b2683f58f2076233039ebf.tar.gz
Print module when dumping rules
It is sometimes hard to find where a rule is defined. Printing the module where it comes from will make it much easier to find. Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3378
Diffstat (limited to 'compiler/coreSyn/CoreSyn.hs')
-rw-r--r--compiler/coreSyn/CoreSyn.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs
index 6762ed6fb2..bee6289ca9 100644
--- a/compiler/coreSyn/CoreSyn.hs
+++ b/compiler/coreSyn/CoreSyn.hs
@@ -4,6 +4,7 @@
-}
{-# LANGUAGE CPP, DeriveDataTypeable, FlexibleContexts #-}
+{-# LANGUAGE NamedFieldPuns #-}
-- | CoreSyn holds all the main data types for use by for the Glasgow Haskell Compiler midsection
module CoreSyn (
@@ -89,7 +90,7 @@ module CoreSyn (
-- ** Operations on 'CoreRule's
ruleArity, ruleName, ruleIdName, ruleActivation,
- setRuleIdName,
+ setRuleIdName, ruleModule,
isBuiltinRule, isLocalRule, isAutoRule,
-- * Core vectorisation declarations data type
@@ -1246,6 +1247,10 @@ ruleArity (Rule {ru_args = args}) = length args
ruleName :: CoreRule -> RuleName
ruleName = ru_name
+ruleModule :: CoreRule -> Maybe Module
+ruleModule Rule { ru_origin } = Just ru_origin
+ruleModule BuiltinRule {} = Nothing
+
ruleActivation :: CoreRule -> Activation
ruleActivation (BuiltinRule { }) = AlwaysActive
ruleActivation (Rule { ru_act = act }) = act