-
---------------------
-splitInlineCont :: SimplCont -> Maybe (SimplCont, SimplCont)
--- Returns Nothing if the continuation should dissolve an InlineMe Note
--- Return Just (c1,c2) otherwise,
--- where c1 is the continuation to put inside the InlineMe
--- and c2 outside
-
--- Example: (__inline_me__ (/\a. e)) ty
--- Here we want to do the beta-redex without dissolving the InlineMe
--- See test simpl017 (and Trac #1627) for a good example of why this is important
-
-splitInlineCont (ApplyTo dup (Type ty) se c)
- | Just (c1, c2) <- splitInlineCont c = Just (ApplyTo dup (Type ty) se c1, c2)
-splitInlineCont cont@(Stop {}) = Just (mkBoringStop, cont)
-splitInlineCont cont@(StrictBind {}) = Just (mkBoringStop, cont)
-splitInlineCont _ = Nothing
- -- NB: we dissolve an InlineMe in any strict context,
- -- not just function aplication.
- -- E.g. foldr k z (__inline_me (case x of p -> build ...))
- -- Here we want to get rid of the __inline_me__ so we
- -- can float the case, and see foldr/build
- --
- -- However *not* in a strict RHS, else we get
- -- let f = __inline_me__ (\x. e) in ...f...
- -- Now if f is guaranteed to be called, hence a strict binding
- -- we don't thereby want to dissolve the __inline_me__; for
- -- example, 'f' might be a wrapper, so we'd inline the worker