Skip to content

Commit 8a84f6a

Browse files
committed
updated to Agda-2.5.2
1 parent 62ce8b3 commit 8a84f6a

File tree

4 files changed

+26
-9
lines changed

4 files changed

+26
-9
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.*~
2+
*.agdai

Examples/DeriveEq.agda

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ module DeriveEqVec where
2222
test₁ : xs ≟ xs ≡ yes refl
2323
test₁ = refl
2424

25-
test₂ : xs ≟ (2 ∷ᵥ 4 ∷ᵥ 2 ∷ᵥ []ᵥ) ≡ no _
25+
-- Makes Agda loop?
26+
-- test₂ : xs ≟ (2 ∷ᵥ 4 ∷ᵥ 2 ∷ᵥ []ᵥ) ≡ no _
27+
-- test₂ = refl
28+
29+
test₂ : xs == (2 ∷ᵥ 4 ∷ᵥ 2 ∷ᵥ []ᵥ) ≡ false
2630
test₂ = refl
2731

2832
module DeriveEqD where
@@ -36,7 +40,7 @@ module DeriveEqD where
3640
{{aEq : Eq A}} {{bEq : {x} -> Eq (B x)}} -> Eq (D A B ys m)
3741
unquoteDef DEq = deriveEqTo DEq (quote D)
3842

39-
-- -- Seems like the problem is that irrelevance and meta-variables resolution do not play well.
43+
-- -- Seems like the problem is that irrelevance and metavariables resolution do not play well.
4044
-- module DeriveEqE where
4145
-- data E {α} (A : Set α) : ∀ {n} -> .(Vec A n) -> Set α where
4246
-- c₁ : ∀ {n} -> .(xs : Vec A n) -> E A xs

Lib/Reflection/Core.agda

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ open import Reflection
44
renaming (visible to expl; hidden to impl; instance′ to inst;
55
relevant to rel; irrelevant to irr; pi to absPi; lam to absLam; def to appDef)
66
hiding (var; con; meta; _≟_) public
7+
open import Agda.Builtin.Reflection using (withNormalisation) public
78
open Term using () renaming (var to appVar; con to appCon; meta to appMeta) public
89
open Pattern using () renaming (var to patVar; con to patCon) public
910
open Literal using () renaming (meta to litMeta) public
@@ -435,11 +436,13 @@ _·_ = sate _$_
435436
unshift′ : Term -> Term
436437
unshift′ t = explLam "_" t · sate tt₀
437438

439+
-- A note for myself: `foldℕ (sate lsuc) (sate lzero) n` is not `reify n`:
440+
-- it's damn `lsuc` -- not `suc`.
438441
termLevelOf : Term -> Maybe Term
439442
termLevelOf (sort (set t)) = just t
440443
termLevelOf (sort (lit n)) = just (foldℕ (sate lsuc) (sate lzero) n)
441444
termLevelOf (sort unknown) = just unknown
442-
termLevelOf _ = nothing
445+
termLevelOf _ = nothing
443446

444447
instance
445448
TermReify : Reify Term
@@ -499,7 +502,6 @@ instance
499502
go [] tt = sate tt₀
500503
go (x ∷ xs) (y , ys) = sate _,_ (reify {{bReify}} y) (go xs ys)
501504

502-
503505
toTuple : List Term -> Term
504506
toTuple = foldr₁ (sate _,_) (sate tt₀)
505507

@@ -528,15 +530,21 @@ normalize (pi s (arg i a) b) =
528530
pi s ∘ arg i <$> normalize a <*> extendContext (arg i a) (normalize b)
529531
normalize t = normalise t
530532

533+
getNormType : Name -> TC Type
534+
getNormType = getType >=> normalize
535+
536+
inferNormType : Term -> TC Type
537+
inferNormType = inferType >=> normalize
538+
531539
getData : Name -> TC (Data Type)
532-
getData d = getType d >>= λ ab -> getDefinition d >>= λ
540+
getData d = getNormType d >>= λ ab -> getDefinition d >>= λ
533541
{ (data-type p cs) ->
534-
mapM (λ c -> _,_ c ∘ dropPis p <$> (getType c >>= normalize)) cs >>= λ mans ->
542+
mapM (λ c -> _,_ c ∘ dropPis p <$> getNormType c) cs >>= λ mans ->
535543
case takePis p ab ⊗ (dropPis p ab ⊗ (mapM (uncurry λ c ma -> flip _,_ c <$> ma) mans)) of λ
536544
{ nothing -> panic "getData: data"
537545
; (just (a , b , acs)) -> return ∘ uncurry (packData d a b) $ splitList acs
538546
}
539-
; (record′ c) -> getType c >>= dropPis (countPis ab) >>> λ
547+
; (record′ c) -> getNormType c >>= dropPis (countPis ab) >>> λ
540548
{ nothing -> panic "getData: record"
541549
; (just a′) -> return $ packData d (initType ab) (lastType ab) (a′ ∷ []) (c , tt)
542550
}
@@ -545,4 +553,7 @@ getData d = getType d >>= λ ab -> getDefinition d >>= λ
545553

546554
macro
547555
TypeOf : Term -> Term -> TC _
548-
TypeOf t ?r = inferType t >>= unify ?r
556+
TypeOf t ?r = inferNormType t >>= unify ?r
557+
558+
runTC : {α} {A : Set α} -> TC A -> Term -> TC _
559+
runTC a ?r = bindTC a quoteTC >>= unify ?r

Reflection/ReadData.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ macro
5555
readData d ?r = getData d >>= quoteData >>= unify ?r
5656

5757
gcoerce : Name -> Term -> TC _
58-
gcoerce fd ?r = inferType ?r >>= onFinalMu λ{ D@(packData _ _ b _ _) ->
58+
gcoerce fd ?r = inferNormType ?r >>= onFinalMu λ{ D@(packData _ _ b _ _) ->
5959
quoteTC (μ D) >>= λ μD ->
6060
traverseAll quoteTC (allCons D) >>= λ cs′ ->
6161
unify ?r $ vis appDef fd (curryBy b μD ∷ allToList cs′)

0 commit comments

Comments
 (0)