Skip to content

Commit 7ef742d

Browse files
committed
refactor: add erasure to So
1 parent 6c02a51 commit 7ef742d

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/Data/Bool/Base.lagda.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ is-true true = ⊤
8181
is-true false = ⊥
8282
8383
record So (b : Bool) : Type where
84+
constructor evidently
8485
field
85-
is-so : is-true b
86+
.{is-so} : is-true b
8687
8788
pattern oh = record { is-so = tt }
8889
```
@@ -104,7 +105,7 @@ instance
104105
H-Level-So : ∀ {x n} → H-Level (So x) (suc n)
105106
H-Level-So {false} = prop-instance λ ()
106107
H-Level-So {true} = prop-instance λ where
107-
oh oh → refl
108+
_ _ → refl
108109
109110
Dec-So : ∀ {x} → Dec (So x)
110111
Dec-So = oh? _

src/Data/List/Base.lagda.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,8 @@ _!?_ : List A → Nat → Maybe A
348348
349349
-- Make sure that all of the actual computation is guarded behind irrelevance to make this zero cost
350350
!?-just : ∀ (xs : List A) (n : Nat) → .(n Nat.< length xs) → is-just (xs !? n)
351-
!?-just {A = a} xs n n<xs = erase (worker xs n n<xs)
352-
where
353-
worker : ∀ (xs : List A) (n : Nat) → n Nat.< length xs → is-true (is-just? (xs !? n))
354-
worker (x ∷ xs) zero n<xs = tt
355-
worker (x ∷ xs) (suc n) n<xs = worker xs n (Nat.≤-peel n<xs)
351+
!?-just {A = a} (x ∷ xs) zero n<xs = just-because evidently
352+
!?-just {A = a} (x ∷ xs) (suc n) n<xs = !?-just xs n (Nat.≤-peel n<xs)
356353
357354
_!_ : (l : List A) → Fin (length l) → A
358355
xs ! (fin n ⦃ forget pf ⦄) = from-just! _ $ !?-just xs n pf

src/Data/Maybe/Base.lagda.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ is-just? nothing = false
8989
is-just? (just _) = true
9090
9191
record is-just (m : Maybe A) : Type where
92-
constructor erase
92+
constructor just-because
9393
field
94-
.witness : is-true (is-just? m)
94+
witness : So (is-just? m)
9595
9696
9797
from-just! : ∀ x → is-just x → A

0 commit comments

Comments
 (0)