Couple of useful Maybe functions (#44)

This commit is contained in:
Patrick Stevens
2019-09-15 15:08:51 +01:00
committed by GitHub
parent 8c51b9b3d1
commit d4ebcc04ce

View File

@@ -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