bind VarP after pats
This commit is contained in:
@@ -125,11 +125,11 @@ exprToCore (LitE l) = litToCore l
|
|||||||
letToCore :: forall es. (NameSupply :> es)
|
letToCore :: forall es. (NameSupply :> es)
|
||||||
=> Rec -> [Rlp.Binding' RlpcPs] -> RlpExpr' RlpcPs -> Eff es Expr'
|
=> Rec -> [Rlp.Binding' RlpcPs] -> RlpExpr' RlpcPs -> Eff es Expr'
|
||||||
letToCore r bs e = do
|
letToCore r bs e = do
|
||||||
|
-- TODO: preserve binder order.
|
||||||
(bs',as) <- getParts
|
(bs',as) <- getParts
|
||||||
e' <- appKendo (foldMap Kendo as) <=< exprToCore $ unXRec e
|
let insbs | null bs' = pure
|
||||||
if null bs'
|
| otherwise = pure . Let r bs'
|
||||||
then pure e'
|
appKendo (foldMap Kendo (as `snoc` insbs)) <=< exprToCore $ unXRec e
|
||||||
else pure $ Let r bs' e'
|
|
||||||
where
|
where
|
||||||
-- partition & map the list of binders into:
|
-- partition & map the list of binders into:
|
||||||
-- bs' : the let-binds that may be directly translated to Core
|
-- bs' : the let-binds that may be directly translated to Core
|
||||||
|
|||||||
Reference in New Issue
Block a user