summaryrefslogtreecommitdiff
path: root/Jennisys/Utils.fs
diff options
context:
space:
mode:
authorGravatar Unknown <t-alekm@A3479878.redmond.corp.microsoft.com>2011-07-20 13:52:17 -0700
committerGravatar Unknown <t-alekm@A3479878.redmond.corp.microsoft.com>2011-07-20 13:52:17 -0700
commit7362894f4f21cbb00aa8d4e3f14cfa21d88ca6c9 (patch)
tree0e48bb17d046eb5584a4dfb8a2e8dbb04aa263af /Jennisys/Utils.fs
parent433e48f008bdb3bdf03cfaf9e09f22708a64356e (diff)
- changed the way Valid() is unrolled
- removed reading from Seq#Build because it doesn't seem to be needed anymore
Diffstat (limited to 'Jennisys/Utils.fs')
-rw-r--r--Jennisys/Utils.fs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Jennisys/Utils.fs b/Jennisys/Utils.fs
index 8c25726a..c9f18e23 100644
--- a/Jennisys/Utils.fs
+++ b/Jennisys/Utils.fs
@@ -48,6 +48,15 @@ let ExtractOptionMsg msg x =
let ExtractOption x =
ExtractOptionMsg "can't extract anything from a None" x
+// ====================================
+/// ensures: res = Some(a) ==> ret = a
+/// ensures: res = None ==> ret = defVal
+// ====================================
+let ExtractOptionOr defVal opt =
+ match opt with
+ | Some(a) -> a
+ | None -> defVal
+
// ==========================================================
/// requres: List.length lst <= 1, otherwise fails with errMsg
/// ensures: if |lst| = 0 then