aboutsummaryrefslogtreecommitdiffstats
path: root/src/CoqUp/Helper.v
diff options
context:
space:
mode:
Diffstat (limited to 'src/CoqUp/Helper.v')
-rw-r--r--src/CoqUp/Helper.v10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/CoqUp/Helper.v b/src/CoqUp/Helper.v
index f57a16f..292d011 100644
--- a/src/CoqUp/Helper.v
+++ b/src/CoqUp/Helper.v
@@ -3,13 +3,19 @@ Module Option.
Definition default {T : Type} (x : T) (u : option T) : T :=
match u with
| Some y => y
- | None => x
+ | _ => x
end.
Definition map {S : Type} {T : Type} (f : S -> T) (u : option S) : option T :=
match u with
| Some y => Some (f y)
- | None => None
+ | _ => None
+ end.
+
+Definition liftA2 {T : Type} (f : T -> T -> T) (a : option T) (b : option T) : option T :=
+ match a with
+ | Some x => map (f x) b
+ | _ => None
end.
End Option.