Skip to content

Commit f5f42e9

Browse files
committed
[ agda#5000 ] Changes related to SizeUniv
PR agda/agda#5000 puts Size into SizeUniv instead of Set, so we need special versions of "Pred" one could call "SizedType".
1 parent 9c56155 commit f5f42e9

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

src/Codata/Thunk.agda

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,27 @@
88

99
module Codata.Thunk where
1010

11+
open import Level
1112
open import Size
12-
open import Relation.Unary
13+
14+
private
15+
variable
16+
ℓ ℓ₁ ℓ₂ : Level
1317

1418
------------------------------------------------------------------------
1519
-- Basic types.
1620

21+
SizedType : (ℓ : Level) Set (suc ℓ)
22+
SizedType ℓ = Size Set
23+
24+
∀ˢ[_] : SizedType ℓ Set
25+
∀ˢ[ F ] = {i} F i
26+
27+
infixr 8 _⇒ˢ_
28+
29+
_⇒ˢ_ : SizedType ℓ₁ SizedType ℓ₂ SizedType (ℓ₁ ⊔ ℓ₂)
30+
F ⇒ˢ G = λ i F i G i
31+
1732
record Thunk {ℓ} (F : Size Set ℓ) (i : Size) : Setwhere
1833
coinductive
1934
field force : {j : Size< i} F j
@@ -42,26 +57,26 @@ syntax Thunk-syntax (λ j → e) i = Thunk[ j < i ] e
4257
-- Thunk is a functor
4358
module _ {p q} {P : Size Set p} {Q : Size Set q} where
4459

45-
map : ∀[ P ⇒ Q ] ∀[ Thunk P ⇒ Thunk Q ]
60+
map :ˢ[ P ⇒ˢ Q ] ˢ[ Thunk P ⇒ˢ Thunk Q ]
4661
map f p .force = f (p .force)
4762

4863
-- Thunk is a comonad
4964
module _ {p} {P : Size Set p} where
5065

51-
extract : ∀[ Thunk P ] P ∞
66+
extract :ˢ[ Thunk P ] P ∞
5267
extract p = p .force
5368

54-
duplicate : ∀[ Thunk P ⇒ Thunk (Thunk P) ]
69+
duplicate :ˢ[ Thunk P ⇒ˢ Thunk (Thunk P) ]
5570
duplicate p .force .force = p .force
5671

5772
module _ {p q} {P : Size Set p} {Q : Size Set q} where
5873

5974
infixl 1 _<*>_
60-
_<*>_ : ∀[ Thunk (P ⇒ Q) ⇒ Thunk P ⇒ Thunk Q ]
75+
_<*>_ :ˢ[ Thunk (P ⇒ˢ Q) ⇒ˢ Thunk P ⇒ˢ Thunk Q ]
6176
(f <*> p) .force = f .force (p .force)
6277

6378
-- We can take cofixpoints of functions only making Thunk'd recursive calls
6479
module _ {p} (P : Size Set p) where
6580

66-
cofix : ∀[ Thunk P ⇒ P ] ∀[ P ]
81+
cofix :ˢ[ Thunk P ⇒ˢ P ] ˢ[ P ]
6782
cofix f = f λ where .force cofix f

src/Size.agda

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
module Size where
1010

1111
open import Agda.Builtin.Size public
12-
renaming ( SizeU to SizeUniv ) -- sort SizeUniv
13-
using ( Size -- Size : SizeUniv
14-
; Size<_ -- Size<_ : Size → SizeUniv
15-
; ↑_ -- ↑_ : Size → Size
16-
; _⊔ˢ_ -- _⊔ˢ_ : Size → Size → Size
17-
; ∞ ) -- ∞ : Size
12+
using ( SizeUniv -- sort SizeUniv
13+
; Size -- Size : SizeUniv
14+
; Size<_ -- Size<_ : Size → SizeUniv
15+
; ↑_ -- ↑_ : Size → Size
16+
; _⊔ˢ_ -- _⊔ˢ_ : Size → Size → Size
17+
; ∞ -- ∞ : Size
18+
)

0 commit comments

Comments
 (0)