Skip to content

Commit d28ee5b

Browse files
committed
Wrap erased fixpoint bodies in lambda
1 parent 4aa1fc0 commit d28ee5b

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/Agda2Lambox/Compile/Function.hs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{-# LANGUAGE NamedFieldPuns, DataKinds, OverloadedStrings #-}
22
-- | Convert Agda functions to λ□ constant declarations
3-
module Agda2Lambox.Compile.Function
3+
module Agda2Lambox.Compile.Function
44
( compileFunction
55
) where
66

@@ -107,8 +107,17 @@ compileFunction (t :: Target t) defn@Defn{defType} = do
107107
builder . flip LBox.LFix k <$>
108108
forM mdefs \def@Defn{defName} -> do
109109
body <- compileFunctionBody mnames def
110-
return LBox.Def
111-
{ dName = qnameToName defName
112-
, dBody = body
113-
, dArgs = 0
114-
}
110+
case body of
111+
LBox.LLambda{} ->
112+
return LBox.Def
113+
{ dName = qnameToName defName
114+
, dBody = body
115+
, dArgs = 0
116+
}
117+
LBox.LBox ->
118+
return LBox.Def
119+
{ dName = qnameToName defName
120+
, dBody = LBox.LLambda LBox.Anon body
121+
, dArgs = 0
122+
}
123+
_ -> genericError "Fixpoint body must be Lambda."

0 commit comments

Comments
 (0)