Skip to content

Wrap erased fixpoint bodies in lambda #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/Agda2Lambox/Compile/Function.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# LANGUAGE NamedFieldPuns, DataKinds, OverloadedStrings #-}
-- | Convert Agda functions to λ□ constant declarations
module Agda2Lambox.Compile.Function
module Agda2Lambox.Compile.Function
( compileFunction
) where

Expand Down Expand Up @@ -107,8 +107,17 @@ compileFunction (t :: Target t) defn@Defn{defType} = do
builder . flip LBox.LFix k <$>
forM mdefs \def@Defn{defName} -> do
body <- compileFunctionBody mnames def
return LBox.Def
{ dName = qnameToName defName
, dBody = body
, dArgs = 0
}
case body of
LBox.LLambda{} ->
return LBox.Def
{ dName = qnameToName defName
, dBody = body
, dArgs = 0
}
LBox.LBox ->
return LBox.Def
{ dName = qnameToName defName
, dBody = LBox.LLambda LBox.Anon body
, dArgs = 0
}
_ -> genericError "Fixpoint body must be Lambda."