Skip to content

Commit fe971b3

Browse files
committed
[ agda/agda#5000 ] Move SizedType etc into module Size
1 parent f5f42e9 commit fe971b3

File tree

3 files changed

+30
-22
lines changed

3 files changed

+30
-22
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ matrix:
5656
cd ../ &&
5757
git clone https://github.com/agda/agda &&
5858
cd agda &&
59-
git checkout 0f4538c8dcd175b92acd577ca0bdca232f5cd17f &&
59+
git checkout a8077a59977d55d85743790924adf24dc0c9de2d &&
6060
cabal install --only-dependencies --dry -v > $HOME/installplan.txt ;
6161
fi
6262

src/Codata/Thunk.agda

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,11 @@
99
module Codata.Thunk where
1010

1111
open import Level
12-
open import Size
13-
14-
private
15-
variable
16-
ℓ ℓ₁ ℓ₂ : Level
12+
open import Size; open SizedType
1713

1814
------------------------------------------------------------------------
1915
-- Basic types.
2016

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-
3217
record Thunk {ℓ} (F : Size Set ℓ) (i : Size) : Setwhere
3318
coinductive
3419
field force : {j : Size< i} F j
@@ -57,26 +42,26 @@ syntax Thunk-syntax (λ j → e) i = Thunk[ j < i ] e
5742
-- Thunk is a functor
5843
module _ {p q} {P : Size Set p} {Q : Size Set q} where
5944

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

6348
-- Thunk is a comonad
6449
module _ {p} {P : Size Set p} where
6550

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

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

7257
module _ {p q} {P : Size Set p} {Q : Size Set q} where
7358

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

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

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

src/Size.agda

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,26 @@ open import Agda.Builtin.Size public
1616
; _⊔ˢ_ -- _⊔ˢ_ : Size → Size → Size
1717
; ∞ -- ∞ : Size
1818
)
19+
20+
open import Level
21+
22+
private
23+
variable
24+
ℓ ℓ₁ ℓ₂ : Level
25+
26+
-- Concept of sized type
27+
28+
SizedType : (ℓ : Level) Set (suc ℓ)
29+
SizedType ℓ = Size Set
30+
31+
-- Type constructors involving SizedType
32+
33+
module SizedType where
34+
35+
infixr 8 _⇒_
36+
37+
_⇒_ : SizedType ℓ₁ SizedType ℓ₂ SizedType (ℓ₁ ⊔ ℓ₂)
38+
F ⇒ G = λ i F i G i
39+
40+
∀[_] : SizedType ℓ Set
41+
∀[ F ] = {i} F i

0 commit comments

Comments
 (0)