Skip to content

Commit d8a37c9

Browse files
committed
Small improvements in Conversion ; marks places where records should be added
1 parent 1e23c07 commit d8a37c9

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

app/Agda/Core/ToCore.hs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,12 @@ toCoreDefn (I.DatatypeDefn dt) ty =
302302
dataConstructors = cons_indexes}
303303
return $ Core.DatatypeDefn d
304304

305-
toCoreDefn (I.RecordDefn _) _ =
306-
throwError "records are not supported"
305+
toCoreDefn (I.RecordDefn rd) ty =
306+
withError (\e -> multiLineText $ "record definition failure \n" <> Pretty.render (nest 1 e)) $ do
307+
let I.RecordData{
308+
_recPars = pars,
309+
_recFields = fields} = rd
310+
throwError "records are not supported"
307311

308312
toCoreDefn (I.ConstructorDefn cs) ty =
309313
withError (\e -> multiLineText $ "constructor definition failure:\n" <> Pretty.render (nest 1 e)) $ do

src/Agda/Core/Checkers/Converter.agda

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,14 @@ convertWhnf r (TSort s) (TSort t) = convSorts s t
246246
-- return (CEtaVar x f b proof)
247247
convertWhnf r functionTerm (TLam x b) =
248248
let
249-
depPairX = ⟨ x ⟩ (Zero ⟨ IsZero refl ⟩)
249+
-- depPairX = ⟨ x ⟩ (Zero ⟨ IsZero refl ⟩)
250250
subsetProof = (subWeaken subRefl)
251251
newScope = singBind r
252-
term = TApp (weakenTerm subsetProof functionTerm) (TVar depPairX)
252+
term = TApp (weakenTerm subsetProof functionTerm) (TVar (VZero x))
253253
in
254254
do
255255
conversionProof <- convertCheck newScope b term
256-
return (CEtaVar2 x functionTerm b conversionProof)
256+
return (CEtaFunctions x functionTerm b conversionProof)
257257
-- convertWhnf r (TLam x v) (TVar x') = tcError "implement eta-functions 2"
258258
-- convertWhnf r (TApp _ _) (TLam _ _) = tcError "implement eta-functions 3"
259259
convertWhnf r _ _ = tcError "two terms are not the same and aren't convertible"

src/Agda/Core/Name.agda

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,6 @@ instance
113113
pattern Vsuc n p = ⟨ _ ⟩ (Suc n ⟨ IsSuc p ⟩)
114114
pattern V2suc n p = ⟨ _ ⟩ (Suc (Suc n) ⟨ IsSuc (IsSuc p) ⟩)
115115
pattern Vzero = ⟨ _ ⟩ Zero ⟨ IsZero refl ⟩
116+
pattern VZero x = ⟨ x ⟩ Zero ⟨ IsZero refl ⟩
116117
pattern Vone = ⟨ _ ⟩ (Suc Zero) ⟨ IsSuc (IsZero refl) ⟩
117118
-------------------------------------------------------------------------------

src/Agda/Core/Rules/Conversion.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,11 @@ data Conv {α} where
118118
(b : Term (α ▸ x))
119119
b ≅ TApp (TVar depPairF) (TVar depPairX)
120120
TVar f ≅ (TLam x b)
121-
CEtaVar2 : (@0 x : Name) (f : Term α) (b : Term (α ▸ x))
121+
CEtaFunctions : (@0 x : Name) (f : Term α) (b : Term (α ▸ x))
122122
let
123-
depPairX = ⟨ x ⟩ (Zero ⟨ IsZero refl ⟩)
124123
subsetProof = (subWeaken subRefl)
125124
in
126-
b ≅ (TApp (weakenTerm subsetProof f) (TVar depPairX))
125+
b ≅ (TApp (weakenTerm subsetProof f) (TVar (VZero x)))
127126
f ≅ (TLam x b)
128127

129128

src/Agda/Core/Syntax/Signature.agda

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ data Defn : Set where
119119
FunctionDefn : (funBody : Term mempty) Defn
120120
DatatypeDefn : (@0 d : NameData) Datatype d Defn
121121
ConstructorDefn : (@0 d : NameData) (@0 c : NameCon d) Constructor c Defn
122+
-- TODO (diode-lang) : add record defn
123+
-- RecordDefn : (@0 d : NameData) {!!} Defn
122124
{-# COMPILE AGDA2HS Defn #-}
123125

124126

src/Agda/Core/Syntax/Term.agda

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ data Term α where
3131
(TermS α (fieldScope c)) Term α
3232
TLam : (@0 x : Name) (v : Term (α ▸ x)) Term α
3333
TApp : (u : Term α) (v : Term α) Term α
34+
-- TODO (diode-lang) : Add record terms
35+
-- TRec : (d : NameData) {!!} Term α
3436
TProj : (u : Term α) (x : NameIn defScope) Term α
3537
TCase : {@0 x : Name}
3638
(d : NameData) -- Datatype of the variable we are splitting on

0 commit comments

Comments
 (0)