Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 8cf5fc6

Browse files
committed
Couple of convenience absurd-related functions were added to Data.So.
1 parent 8526a9f commit 8cf5fc6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

libs/base/Data/So.idr

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Data.So
1212
||| If you find yourself using `So` for something other than primitive types,
1313
||| it may be appropriate to define a type of evidence for the property that you
1414
||| care about instead.
15-
data So : Bool -> Type where
15+
data So : Bool -> Type where
1616
Oh : So True
1717

1818
implementation Uninhabited (So False) where
@@ -23,4 +23,14 @@ choose : (b : Bool) -> Either (So b) (So (not b))
2323
choose True = Left Oh
2424
choose False = Right Oh
2525

26+
||| Absurd when you have proof that both `b` and `not b` is true.
27+
export
28+
soAbsurd : So b -> So (not b) -> Void
29+
soAbsurd sb snb with (sb)
30+
| Oh = uninhabited snb
31+
32+
||| Transmission between usage of value-level `not` and type-level `Not`.
33+
export
34+
soNotToNotSo : So (not b) -> Not (So b)
35+
soNotToNotSo = flip soAbsurd
2636

0 commit comments

Comments
 (0)