Skip to content

Commit 1725831

Browse files
committed
Updated to Agda-2.6.1
1 parent f448ab3 commit 1725831

File tree

7 files changed

+27
-22
lines changed

7 files changed

+27
-22
lines changed

readme.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
It's a library for doing generic programming in Agda.
44

5+
The library is tested with Agda-2.6.1 and likely does not work with other versions of Agda.
6+
57
# A quick taste
68

79
Deriving decidable equality for vectors:
@@ -32,8 +34,6 @@ instance StarEq : ∀ {i t} {I : Set i} {T : Rel I t} {i j}
3234
unquoteDef StarEq = deriveEqTo StarEq (quote Star)
3335
```
3436

35-
(For this to type check you need the recent development version of Agda (as of 09.08.16))
36-
3737
# Internally
3838

3939
Descriptions of constructors are defined as follows:
@@ -216,7 +216,9 @@ There are also generic `elim` in [`Function/Elim.agda`](Function/Elim.agda) (the
216216

217217
# Limitations
218218

219-
- No inductive-inductive or inductive-recursive data types. The latter [can be done](https://github.com/effectfully/random-stuff/blob/master/Desc/IRDesc.agda) at the cost of complicating the encoding.
219+
- No support for mutually recursive data types. They can be supported, I just haven't implemented that.
220+
221+
- No support for inductive-inductive or inductive-recursive data types. The latter [can be done](https://github.com/effectfully/random-stuff/blob/master/Desc/IRDesc.agda) at the cost of complicating the encoding.
220222

221223
- No coinduction.
222224

@@ -226,4 +228,4 @@ There are also generic `elim` in [`Function/Elim.agda`](Function/Elim.agda) (the
226228

227229
- Ornaments may or may not appear later (in the way described in [Unbiased ornaments](http://effectfully.blogspot.com/2016/07/unbiased-ornaments.html)). I don't find them very vital currently.
228230

229-
- No forcing of indices. [`Lift`](Examples/Data/Lift.agda) can be described, though.
231+
- No forcing of indices. [`Lift`](Examples/Data/Lift.agda) can be described, though.

src/Generic/Core.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ _≤ℓ_ : Level -> Level -> Set
1212
α ≤ℓ β = α ⊔ β ≡ β
1313

1414
mutual
15-
Binder : {ι} α β γ -> Arg-info -> ι ⊔ lsuc (α ⊔ β) ≡ γ -> Set ι -> Set γ
15+
Binder : {ι} α β γ -> ArgInfo -> ι ⊔ lsuc (α ⊔ β) ≡ γ -> Set ι -> Set γ
1616
Binder α β γ i q I = Coerce q (∃ λ (A : Set α) -> < relevance i > A -> Desc I β)
1717

1818
data Desc {ι} (I : Set ι) β : Set (ι ⊔ lsuc β) where

src/Generic/Examples/Data/Product.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Generic.Examples.Data.Product where
22

3-
open import Generic.Main as Main hiding (Σ; proj₁; proj₂) renaming (_,_ to _,′_)
3+
open import Generic.Main as Main hiding (Σ; proj₁; proj₂; _,′_) renaming (_,_ to _,′_)
44

55
infixr 4 _,_
66

src/Generic/Examples/DeriveEq.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ open import Data.Vec using (Vec) renaming ([] to []ᵥ; _∷_ to _∷ᵥ_)
66

77
module DeriveEqStar where
88
open import Relation.Binary
9-
open import Data.Star
9+
open import Relation.Binary.Construct.Closure.ReflexiveTransitive
1010

1111
instance StarEq : {i t} {I : Set i} {T : Rel I t} {i j}
1212
{{iEq : Eq I}} {{tEq : {i j} -> Eq (T i j)}} -> Eq (Star T i j)

src/Generic/Lib/Reflection/Core.agda

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
module Generic.Lib.Reflection.Core where
22

3+
open import Agda.Builtin.Reflection using (withNormalisation; Relevance; Visibility; clause) public
34
open import Reflection
45
renaming (visible to expl; hidden to impl; instance′ to inst;
56
relevant to rel; irrelevant to irr; pi to absPi; lam to absLam; def to appDef)
6-
hiding (var; con; meta; _≟_; return; _>>=_; _>>_) public
7-
open import Agda.Builtin.Reflection using (withNormalisation) public
7+
hiding (Arg-info; var; con; meta; visibility; relevance; _≟_; return; _>>=_; _>>_) public
8+
open import Reflection.Argument.Information using (ArgInfo; visibility; relevance) public
9+
import Reflection.Name
810
open Term using () renaming (var to appVar; con to appCon; meta to appMeta) public
911
open Pattern using () renaming (var to patVar; con to patCon) public
1012
open Literal using () renaming (meta to litMeta) public
13+
open Sort public
1114

1215
open import Generic.Lib.Intro
1316
open import Generic.Lib.Equality.Propositional
@@ -238,7 +241,7 @@ open Data public
238241

239242
instance
240243
NameEq : Eq Name
241-
NameEq = viaBase _≟-Name_
244+
NameEq = viaBase Reflection.Name._≟_
242245

243246
EqRelValue : {α r} {A : Set α} {{aEq : RelEq r A}} -> Eq (< r > A)
244247
EqRelValue {A = A} {{aEq}} = record
@@ -286,7 +289,7 @@ mutual
286289
ren ι (lam v s t) = lam v s (ren (keep ι) t)
287290
ren ι (pat-lam cs xs) = undefined where postulate undefined : _
288291
ren ι (pi s a b) = pi s (ren ι <$> a) (ren (keep ι) b)
289-
ren ι (sort s) = sort (renSort ι s)
292+
ren ι (agda-sort s) = agda-sort (renSort ι s)
290293
ren ι (lit l) = lit l
291294
ren ι (appMeta x xs) = appMeta x (rens ι xs)
292295
ren ι unknown = unknown
@@ -322,7 +325,7 @@ mutual
322325
mapName f n (lam v s t) = lam v s (mapName (f ∘ suc) n t)
323326
mapName f n (pat-lam cs xs) = undefined where postulate undefined : _
324327
mapName f n (pi s a b) = pi s (mapName f n <$> a) (mapName (f ∘ suc) n b)
325-
mapName f n (sort s) = sort (mapNameSort f n s)
328+
mapName f n (agda-sort s) = agda-sort (mapNameSort f n s)
326329
mapName f n (lit l) = lit l
327330
mapName f n (appMeta x xs) = appMeta x (mapNames f n xs)
328331
mapName f n unknown = unknown
@@ -424,8 +427,8 @@ macro
424427
getType f >>= λ a ->
425428
let res = λ app -> quoteTC (vis# (countExplPis a) app f) >>= unify ?r in
426429
getDefinition f >>= λ
427-
{ (constructor′ _) -> res appCon
428-
; _ -> res appDef
430+
{ (data-cons _) -> res appCon
431+
; _ -> res appDef
429432
}
430433

431434
sateMacro : Name -> Term -> TC _
@@ -442,9 +445,9 @@ unshift′ t = explLam "_" t · sate tt₀
442445
-- A note for myself: `foldℕ (sate lsuc) (sate lzero) n` is not `reify n`:
443446
-- it's damn `lsuc` -- not `suc`.
444447
termLevelOf : Term -> Maybe Term
445-
termLevelOf (sort (set t)) = just t
446-
termLevelOf (sort (lit n)) = just (foldℕ (sate lsuc) (sate lzero) n)
447-
termLevelOf (sort unknown) = just unknown
448+
termLevelOf (agda-sort (set t)) = just t
449+
termLevelOf (agda-sort (lit n)) = just (foldℕ (sate lsuc) (sate lzero) n)
450+
termLevelOf (agda-sort unknown) = just unknown
448451
termLevelOf _ = nothing
449452

450453
instance
@@ -475,7 +478,7 @@ instance
475478
}
476479
}
477480

478-
ArgInfoReify : Reify Arg-info
481+
ArgInfoReify : Reify ArgInfo
479482
ArgInfoReify = record
480483
{ reify = λ{ (arg-info v r) -> sate arg-info (reify v) (reify r) }
481484
}
@@ -547,11 +550,11 @@ getData d = getNormType d >>= λ ab -> getDefinition d >>= λ
547550
{ nothing -> panic "getData: data"
548551
; (just (a , b , acs)) -> return ∘ uncurry (packData d a b) $ splitList acs
549552
}
550-
; (record c _) -> getNormType c >>= dropPis (countPis ab) >>> λ
553+
; (record-type c _) -> getNormType c >>= dropPis (countPis ab) >>> λ
551554
{ nothing -> panic "getData: record"
552555
; (just a′) -> return $ packData d (initType ab) (lastType ab) (a′ ∷ []) (c , tt)
553556
}
554-
; _ -> throw "not a data"
557+
; _ -> throw "not a data"
555558
}
556559

557560
macro

src/Generic/Lib/Reflection/Fold.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ foldTypeOf (packData d a b cs ns) = appendType iab ∘ pi "π" π ∘ pi "P" P $
1717
ab = appendType a b
1818
iab = implicitize ab
1919
π = implRelArg (quoteTerm Level)
20-
P = explRelArg ∘ appendType (shiftBy (suc j) b) ∘ sort ∘ set $ pureVar j
20+
P = explRelArg ∘ appendType (shiftBy (suc j) b) ∘ agda-sort ∘ set $ pureVar j
2121
hyp = mapName (λ p -> appVar p ∘ drop i) d ∘ shiftBy (2 + j)
2222
_ʰ→_ = flip $ foldr (λ c r -> hyp c ‵→ shift r)
2323
from = appDef d (pisToArgVars (2 + i + j) ab)

src/Generic/Reflection/ReadData.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Generic.Reflection.ReadData where
33
open import Generic.Core
44
open import Generic.Function.FoldMono
55

6-
‵π : Arg-info -> String -> Term -> Term -> Term
6+
‵π : ArgInfo -> String -> Term -> Term -> Term
77
‵π i s a b = sate π (reify i) (sate refl) ∘ sate coerce ∘ sate _,_ a $
88
appDef (quote appRel) (implRelArg (reify (relevance i)) ∷ explRelArg (explLam s b) ∷ [])
99

0 commit comments

Comments
 (0)