Skip to content

Compile function parameter types to TInd instead of TConst #14

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
7 changes: 4 additions & 3 deletions src/Agda2Lambox/Compile/Type.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Agda.Syntax.Common.Pretty ( prettyShow )
import Agda.Utils.Monad (ifM)

import qualified LambdaBox as LBox
import Agda2Lambox.Compile.Utils ( qnameToKName, isLogical )
import Agda2Lambox.Compile.Utils ( qnameToKName, isLogical, toInductive )
import Agda2Lambox.Compile.Monad
import Agda.Compiler.Backend (HasConstInfo(getConstInfo), Definition(Defn), AddContext (addContext))
import Agda.Utils (isDataOrRecDef, getInductiveParams, isArity, maybeUnfoldCopy)
Expand Down Expand Up @@ -142,8 +142,9 @@ compileTypeTerm = \case
if isLogicalDef then pure ([], LBox.TBox)

-- if it's an inductive, we only apply the parameters
else if isDataOrRecDef def then
([],) . foldl' LBox.TApp (LBox.TConst $ qnameToKName q)
else if isDataOrRecDef def then do
ind <- liftTCM $ toInductive q
([],) . foldl' LBox.TApp (LBox.TInd ind)
<$> compileElims (take (getInductiveParams def) es)

-- TODO: check if it is a type alias
Expand Down