Skip to content

Commit

Permalink
Add missing COMPILE pragmas
Browse files Browse the repository at this point in the history
  • Loading branch information
jespercockx committed Jul 27, 2024
1 parent 11bbc77 commit 9f974cc
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/Agda/Core/Converter.agda
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ module Agda.Core.Converter
{{@0 sig : Signature}}
where

{-# FOREIGN AGDA2HS import Agda.Core.TCMInstances #-}

private open module @0 G = Globals globals

private variable
Expand Down
12 changes: 12 additions & 0 deletions src/Agda/Core/Reduce.agda
Original file line number Diff line number Diff line change
Expand Up @@ -60,27 +60,39 @@ data Frame (@0 α : Scope Name) : Set where
FProj : (@0 x : Name) {@(tactic auto) _ : x ∈ defScope} Frame α
FCase : (bs : Branches α cs) (m : Type (x ◃ α)) Frame α

{-# COMPILE AGDA2HS Frame #-}

unFrame : Frame α Term α Term α
unFrame (FApp v) u = TApp u v
unFrame (FProj f) u = TProj u f
unFrame (FCase bs m) u = TCase u bs m

{-# COMPILE AGDA2HS unFrame #-}

weakenFrame : α ⊆ β Frame α Frame β
weakenFrame s (FApp u) = FApp (weaken s u)
weakenFrame s (FProj f) = FProj f
weakenFrame s (FCase bs m) = FCase (weakenBranches s bs) (weakenType (subBindKeep s) m)

{-# COMPILE AGDA2HS weakenFrame #-}

Stack : (@0 α : Scope Name) Set
Stack α = List (Frame α)

{-# COMPILE AGDA2HS Stack #-}

unStack : Stack α Term α Term α
unStack [] u = u
unStack (f ∷ fs) u = unStack fs (unFrame f u)

{-# COMPILE AGDA2HS unStack #-}

weakenStack : α ⊆ β Stack α Stack β
weakenStack s [] = []
weakenStack s (f ∷ fs) = weakenFrame s f ∷ weakenStack s fs

{-# COMPILE AGDA2HS weakenStack #-}

record State (@0 α : Scope Name) : Set where
constructor MkState
field
Expand Down
2 changes: 1 addition & 1 deletion src/Agda/Core/Signature.agda
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ opaque
d
caseTelBind (ExtendTel _ a tel) f = f a tel


{-# COMPILE AGDA2HS caseTelEmpty #-}
{-# COMPILE AGDA2HS caseTelBind #-}

record Constructor (@0 pars : Scope Name) (@0 ixs : Scope Name) (@0 c : Name) (@0 cp : c ∈ conScope) : Set where
Expand Down
12 changes: 10 additions & 2 deletions src/Agda/Core/Syntax.agda
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ record Type α where
typeSort : Sort α
unType : Term α
open Type public
{-# COMPILE AGDA2HS Type #-}
{-# COMPILE AGDA2HS Type deriving Show #-}

data Subst : (@0 α β : Scope Name) Set where
SNil : Subst mempty β
Expand Down Expand Up @@ -101,7 +101,7 @@ data Branch α where
data Branches α where
BsNil : Branches α mempty
BsCons : Branch α c Branches α cs Branches α (c ◃ cs)
{-# COMPILE AGDA2HS Branches #-}
{-# COMPILE AGDA2HS Branches deriving Show #-}

opaque
unfolding Scope
Expand All @@ -121,10 +121,12 @@ opaque
rezzBranches : Branches α β Rezz β
rezzBranches BsNil = rezz mempty
rezzBranches (BsCons {c = c} bh bt) = rezzCong (λ cs c ◃ cs) (rezzBranches bt)
{-# COMPILE AGDA2HS rezzBranches #-}

allBranches : Branches α β All (λ c c ∈ conScope) β
allBranches BsNil = allEmpty
allBranches (BsCons (BBranch _ {ci} _ _) bs) = allJoin (allSingl ci) (allBranches bs)
{-# COMPILE AGDA2HS allBranches #-}

apply : Term α Term α Term α
apply u v = TApp u v
Expand Down Expand Up @@ -229,6 +231,7 @@ weakenSort p (STyp x) = STyp x
{-# COMPILE AGDA2HS weakenSort #-}

weakenType p (El st t) = El (weakenSort p st) (weaken p t)
{-# COMPILE AGDA2HS weakenType #-}

weakenBranch p (BBranch c r x) = BBranch c r (weaken (subJoinKeep (rezzCong revScope r) p) x)
{-# COMPILE AGDA2HS weakenBranch #-}
Expand Down Expand Up @@ -262,6 +265,8 @@ concatSubst SNil q =
concatSubst (SCons v p) q =
subst0 (λ α Subst α _) (associativity _ _ _) (SCons v (concatSubst p q))

{-# COMPILE AGDA2HS concatSubst #-}

opaque
unfolding Scope Sub

Expand All @@ -271,6 +276,8 @@ opaque
SCons (TVar x {coerce p inHere})
(subToSubst (rezz α) (joinSubRight (rezz _) p))

{-# COMPILE AGDA2HS subToSubst #-}

opaque
unfolding Scope revScope

Expand Down Expand Up @@ -307,6 +314,7 @@ raiseSubst {β = β} r (SCons {α = α} u e) =

revIdSubst : {@0 α : Scope Name} Rezz α α ⇒ ~ α
revIdSubst {α} r = subst0 (λ s s ⇒ (~ α)) (revsInvolution α) (revSubst (idSubst (rezzCong revScope r)))
{-# COMPILE AGDA2HS revIdSubst #-}

raise : {@0 α β : Scope Name} Rezz α Term β Term (α <> β)
raise r = weaken (subJoinDrop r subRefl)
Expand Down
1 change: 1 addition & 0 deletions src/Agda/Core/Typechecker.agda
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ inferData ctx d pars ixs = do
typars checkSubst ctx (weakenTel subEmpty (dataParameterTel dt)) pars
tyixs checkSubst ctx (substTelescope pars (dataIndexTel dt)) ixs
return (sortType (substSort pars (dataSort dt)) , TyData d dt deq typars tyixs)
{-# COMPILE AGDA2HS inferData #-}

checkBranch : {@0 con : Name} (Γ : Context α)
(bs : Branch α con)
Expand Down
4 changes: 4 additions & 0 deletions src/Agda/Core/Typing.agda
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ data TyBranches {α} Γ dt ps rt where
TyBranches Γ dt ps rt bs
TyBranches Γ dt ps rt (BsCons b bs)

{-# COMPILE AGDA2HS TyBranches #-}

data TyBranch {α} Γ dt ps rt where
TyBBranch : (@0 c : Name) (c∈dcons : c ∈ dataConstructorScope dt)
(let (c∈cons , con ) = dataConstructors dt c)
Expand All @@ -177,6 +179,8 @@ data TyBranch {α} Γ dt ps rt where
TyTerm (addContextTel ctel Γ) rhs (substType bsubst rt)
TyBranch Γ dt ps rt (BBranch c {c∈cons} r rhs)

{-# COMPILE AGDA2HS TyBranch #-}

data TySubst {α} Γ where
TyNil : TySubst Γ SNil EmptyTel
TyCons : {@0 r : Rezz α}
Expand Down

0 comments on commit 9f974cc

Please sign in to comment.