Skip to content

Commit 1f68cfe

Browse files
Polymorphic unit and empty rethink (#1204)
1 parent acdad6c commit 1f68cfe

File tree

19 files changed

+119
-85
lines changed

19 files changed

+119
-85
lines changed

CHANGELOG.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ Bug-fixes
2121
Non-backwards compatible changes
2222
--------------------------------
2323

24+
* `Data.Empty.Polymorphic` and `Data.Unit.Polymorphic` were rewritten
25+
to explicitly use `Lift` rather that defining new types. This means
26+
that these are now compatible with `` and `` from the rest of the
27+
library. This allowed them to be used in the rest of library where
28+
explicit `Lift` was used.
29+
2430
Deprecated modules
2531
------------------
2632

@@ -44,8 +50,8 @@ Deprecated names
4450
* `Relation.Binary.Construct.StrictToNonStrict.decidable'``Relation.Binary.Construct.StrictToNonStrict.decidable′`
4551

4652

47-
Other major additions
48-
---------------------
53+
New modules
54+
-----------
4955

5056
* Instance modules:
5157
```agda
@@ -93,6 +99,11 @@ Other major additions
9399
Data.Nat.Binary.Subtraction
94100
```
95101

102+
* Indexed nullary relations/sets:
103+
```
104+
Relation.Nullary.Indexed
105+
```
106+
96107
Other major changes
97108
-------------------
98109

@@ -300,7 +311,6 @@ Other minor additions
300311
nonPositive : p ≤ 0ℚᵘ → NonPositive p
301312
nonNegative : p ≥ 0ℚᵘ → NonNegative p
302313
```
303-
304314
* Added new operator to `Relation.Binary`:
305315
```agda
306316
_⇔_ : REL A B ℓ₁ → REL A B ℓ₂ → Set _

src/Category/Applicative.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module RawApplicative {F : Set f → Set f}
2626
(app : RawApplicative F) where
2727
open RawIApplicative app public
2828

29-
RawApplicativeZero : (Set f Set f) Set _
29+
RawApplicativeZero : (Set f Set f) Set (suc f)
3030
RawApplicativeZero F = RawIApplicativeZero {I = ⊤} (λ _ _ F)
3131

3232
module RawApplicativeZero {F : Set f Set f}

src/Category/Monad/Reader.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ ReaderTIMonadReader Mon = record
102102
------------------------------------------------------------------------
103103
-- Ordinary reader monads
104104

105-
RawMonadReader : (M : Set (r ⊔ a) Set (r ⊔ a)) Set _
105+
RawMonadReader : (M : Set (r ⊔ a) Set (r ⊔ a)) Set (suc (r ⊔ a))
106106
RawMonadReader M = RawIMonadReader {I = ⊤} (λ _ _ M)
107107

108108
module RawMonadReader {M} (Mon : RawMonadReader M) where

src/Category/Monad/State.agda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ StateTIMonadState S Mon = record
105105
------------------------------------------------------------------------
106106
-- Ordinary state monads
107107

108-
RawMonadState : Set f (Set f Set f) Set _
108+
RawMonadState : Set f (Set f Set f) Set (suc f)
109109
RawMonadState S M = RawIMonadState {I = ⊤} (λ _ S) (λ _ _ M)
110110

111111
module RawMonadState {S : Set f} {M : Set f Set f}

src/Data/Container/Combinator.agda

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

99
module Data.Container.Combinator where
1010

11-
open import Level using (Level; _⊔_; Lift)
12-
open import Data.Empty using (⊥)
11+
open import Level using (Level; _⊔_)
12+
open import Data.Empty.Polymorphic using (⊥)
1313
open import Data.Product as P using (_,_; proj₁; proj₂; ∃)
1414
open import Data.Sum.Base as S using ([_,_]′)
15-
open import Data.Unit.Base using (⊤)
15+
open import Data.Unit.Polymorphic.Base using (⊤)
1616
import Function as F
1717

1818
open import Data.Container.Core
@@ -26,14 +26,14 @@ module _ {s p : Level} where
2626
-- Identity.
2727

2828
id : Container s p
29-
id .Shape = Lift s
30-
id .Position = F.const (Lift p ⊤)
29+
id .Shape =
30+
id .Position = F.const
3131

3232
-- Constant.
3333

3434
const : Set s Container s p
3535
const X .Shape = X
36-
const X .Position = F.const (Lift p ⊥)
36+
const X .Position = F.const
3737

3838
-- Composition.
3939

src/Data/Container/Indexed/Combinator.agda

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module Data.Container.Indexed.Combinator where
1010

1111
open import Axiom.Extensionality.Propositional using (Extensionality)
1212
open import Data.Container.Indexed
13-
open import Data.Empty using (⊥; ⊥-elim)
14-
open import Data.Unit.Base using (⊤)
13+
open import Data.Empty.Polymorphic using (⊥; ⊥-elim)
14+
open import Data.Unit.Polymorphic.Base using (⊤)
1515
open import Data.Product as Prod hiding (Σ) renaming (_×_ to _⟨×⟩_)
1616
open import Data.Sum renaming (_⊎_ to _⟨⊎⟩_)
1717
open import Function as F hiding (id; const) renaming (_∘_ to _⟨∘⟩_)
@@ -29,13 +29,13 @@ open import Relation.Binary.PropositionalEquality as P
2929
-- Identity.
3030

3131
id : {o c r} {O : Set o} Container O O c r
32-
id = F.const (Lift _ ⊤)(λ _ Lift _ ⊤) / (λ {o} _ _ o)
32+
id = F.const F.const ⊤ / (λ {o} _ _ o)
3333

3434
-- Constant.
3535

3636
const : {i o c r} {I : Set i} {O : Set o}
3737
Pred O c Container I O c r
38-
const X = X ◃ (λ _ Lift _ ⊥) / λ _ ⊥-elim ⟨∘⟩ lower
38+
const X = X ◃ F.const ⊥ / F.const ⊥-elim
3939

4040
-- Duality.
4141

@@ -165,10 +165,10 @@ module Constant (ext : ∀ {ℓ} → Extensionality ℓ ℓ) where
165165
to = proj₁
166166

167167
from : X ⊆ ⟦ const X ⟧ Y
168-
from = < F.id , F.const (⊥-elim ⟨∘⟩ lower) >
168+
from = < F.id , F.const ⊥-elim >
169169

170170
to∘from : _
171-
to∘from xs = P.cong (proj₁ xs ,_) (ext (⊥-elim ⟨∘⟩ lower))
171+
to∘from xs = P.cong (proj₁ xs ,_) (ext ⊥-elim)
172172

173173
module Duality where
174174

src/Data/Empty/Polymorphic.agda

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88

99
module Data.Empty.Polymorphic where
1010

11+
import Data.Empty as Empty
1112
open import Level
1213

13-
data {ℓ : Level} : Setwhere
14+
: {ℓ : Level} Set
15+
⊥ {ℓ} = Lift ℓ Empty.⊥
1416

15-
⊥-elim : {w ℓ} {Whatever : Set w} ⊥ {ℓ} Whatever
17+
-- make ⊥-elim dependent too, as it does seem useful
18+
⊥-elim : {w ℓ} {Whatever : ⊥ {ℓ} Set w} (witness : ⊥ {ℓ}) Whatever witness
1619
⊥-elim ()

src/Data/List/Fresh.agda

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
module Data.List.Fresh where
1515

16-
open import Level using (Level; _⊔_; Lift)
16+
open import Level using (Level; _⊔_)
1717
open import Data.Bool.Base using (true; false)
18-
open import Data.Unit.Base
18+
open import Data.Unit.Polymorphic.Base using (⊤)
1919
open import Data.Product using (∃; _×_; _,_; -,_; proj₁; proj₂)
2020
open import Data.List.Relation.Unary.All using (All; []; _∷_)
2121
open import Data.List.Relation.Unary.AllPairs using (AllPairs; []; _∷_)
@@ -57,7 +57,7 @@ module _ {a} (A : Set a) (R : Rel A r) where
5757
infixr 5 _∷#_
5858
pattern _∷#_ x xs = cons x xs _
5959

60-
fresh a [] = Lift _
60+
fresh a [] =
6161
fresh a (x ∷# xs) = R a x × fresh a xs
6262

6363
-- Convenient notation for freshness making A and R implicit parameters

src/Data/List/Relation/Binary/BagAndSetEquality.agda

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ import Data.Product.Function.Dependent.Propositional as Σ
2626
open import Data.Sum.Base as Sum hiding (map)
2727
open import Data.Sum.Properties hiding (map-cong)
2828
open import Data.Sum.Function.Propositional using (_⊎-cong_)
29-
open import Data.Unit
29+
open import Data.Unit.Polymorphic.Base
3030
open import Function.Base
3131
open import Function.Equality using (_⟨$⟩_)
3232
import Function.Equivalence as FE
3333
open import Function.Inverse as Inv using (_↔_; Inverse; inverse)
3434
open import Function.Related as Related
3535
using (↔⇒; ⌊_⌋; ⌊_⌋→; ⇒→; K-refl; SK-sym)
3636
open import Function.Related.TypeIsomorphisms
37-
open import Level using (Lift)
3837
open import Relation.Binary
3938
import Relation.Binary.Reasoning.Setoid as EqR
4039
import Relation.Binary.Reasoning.Preorder as PreorderReasoning
@@ -359,7 +358,7 @@ drop-cons {A = A} {x} {xs} {ys} x∷xs≈x∷ys =
359358
(∃ λ z z ∈ xs) ↔⟨ Σ.cong K-refl (∈-index xs) ⟩
360359
(∃ λ z λ i z ≡ lookup xs i) ↔⟨ ∃∃↔∃∃ _ ⟩
361360
(∃ λ i λ z z ≡ lookup xs i) ↔⟨ Σ.cong K-refl (inverse _ (λ _ _ , refl) (λ { (_ , refl) refl }) (λ _ refl)) ⟩
362-
(Fin (length xs) × Lift _ ⊤) ↔⟨ ×-identityʳ _ _ ⟩
361+
(Fin (length xs) × ⊤) ↔⟨ ×-identityʳ _ _ ⟩
363362
Fin (length xs) ∎
364363
where
365364
open Related.EquationalReasoning

src/Data/Nat/Induction.agda

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ open import Function
1212
open import Data.Nat.Base
1313
open import Data.Nat.Properties using (≤⇒≤′)
1414
open import Data.Product
15-
open import Data.Unit
15+
open import Data.Unit.Polymorphic
1616
open import Induction
1717
open import Induction.WellFounded as WF
18-
open import Level using (Lift)
1918
open import Relation.Binary.PropositionalEquality
2019
open import Relation.Unary
2120

@@ -28,7 +27,7 @@ open WF public using (Acc; acc)
2827
-- Ordinary induction
2928

3029
Rec : RecStruct ℕ ℓ ℓ
31-
Rec ℓ P zero = Lift ℓ
30+
Rec ℓ P zero =
3231
Rec ℓ P (suc n) = P n
3332

3433
recBuilder : {ℓ} RecursorBuilder (Rec ℓ)
@@ -42,7 +41,7 @@ rec = build recBuilder
4241
-- Complete induction
4342

4443
CRec : RecStruct ℕ ℓ ℓ
45-
CRec ℓ P zero = Lift ℓ
44+
CRec ℓ P zero =
4645
CRec ℓ P (suc n) = P n × CRec ℓ P n
4746

4847
cRecBuilder : {ℓ} RecursorBuilder (CRec ℓ)

0 commit comments

Comments
 (0)