summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Core.hs')
-rw-r--r--compiler/GHC/Core.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs
index 168e33e189..46ecd8bed3 100644
--- a/compiler/GHC/Core.hs
+++ b/compiler/GHC/Core.hs
@@ -41,7 +41,7 @@ module GHC.Core (
isId, cmpAltCon, cmpAlt, ltAlt,
-- ** Simple 'Expr' access functions and predicates
- bindersOf, bindersOfBinds, rhssOfBind, rhssOfAlts,
+ decomposeBind, bindersOf, bindersOfBinds, rhssOfBind, rhssOfAlts,
collectBinders, collectTyBinders, collectTyAndValBinders,
collectNBinders,
collectArgs, stripNArgs, collectArgsTicks, flattenBinds,
@@ -2123,6 +2123,11 @@ exprToCoercion_maybe _ = Nothing
************************************************************************
-}
+-- | Turn a binding group into a 'RecFlag' and a list of bindings.
+decomposeBind :: Bind b -> (RecFlag, [(b, Expr b)])
+decomposeBind (NonRec bndr rhs) = (NonRecursive, [(bndr, rhs)])
+decomposeBind (Rec pairs) = (Recursive, pairs)
+
-- | Extract every variable by this group
bindersOf :: Bind b -> [b]
-- If you edit this function, you may need to update the GHC formalism