mirror of
https://github.com/Smaug123/agdaproofs
synced 2025-10-12 07:08:40 +00:00
Couple of useful Maybe functions (#44)
This commit is contained in:
@@ -31,3 +31,9 @@ module Maybe where
|
||||
defaultValue : {a : _} → {A : Set a} → (default : A) → Maybe A → A
|
||||
defaultValue default no = default
|
||||
defaultValue default (yes x) = x
|
||||
|
||||
noNotYes : {a : _} {A : Set a} {b : A} → (no ≡ yes b) → False
|
||||
noNotYes ()
|
||||
|
||||
mapMaybePreservesNo : {a b : _} {A : Set a} {B : Set b} (f : A → B) (x : Maybe A) → mapMaybe f x ≡ no → x ≡ no
|
||||
mapMaybePreservesNo f no pr = refl
|
||||
|
Reference in New Issue
Block a user