summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-12-12 11:02:20 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-12-12 11:02:20 -0500
commit84e471e64566698a5489810836b6ec80824d3e46 (patch)
treeab722581146ac2de00f49743a319f6b3ccf35a6e
parent5b89513c103be2bde3048d8310469e4a0a7d5d1d (diff)
Checked-ness of radio options; Option.get
-rw-r--r--lib/ur/basis.urs2
-rw-r--r--lib/ur/option.ur5
-rw-r--r--lib/ur/option.urs2
3 files changed, 8 insertions, 1 deletions
diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs
index 0347febc..545e65aa 100644
--- a/lib/ur/basis.urs
+++ b/lib/ur/basis.urs
@@ -680,7 +680,7 @@ val blobSize : blob -> int
con radio = [Body, Radio]
val radio : formTag string radio [Id = string]
-val radioOption : unit -> tag ([Value = string] ++ boxAttrs) radio [] [] []
+val radioOption : unit -> tag ([Value = string, Checked = bool] ++ boxAttrs) radio [] [] []
con select = [Select]
val select : formTag string select ([Onchange = transaction unit] ++ boxAttrs)
diff --git a/lib/ur/option.ur b/lib/ur/option.ur
index 1ba33d8e..0aa07a2d 100644
--- a/lib/ur/option.ur
+++ b/lib/ur/option.ur
@@ -38,3 +38,8 @@ fun bind [a] [b] f x =
case x of
None => None
| Some y => f y
+
+fun get [a] (x : a) (o : option a) =
+ case o of
+ None => x
+ | Some v => v
diff --git a/lib/ur/option.urs b/lib/ur/option.urs
index 60ca6db9..62687963 100644
--- a/lib/ur/option.urs
+++ b/lib/ur/option.urs
@@ -8,3 +8,5 @@ val isSome : a ::: Type -> t a -> bool
val mp : a ::: Type -> b ::: Type -> (a -> b) -> t a -> t b
val bind : a ::: Type -> b ::: Type -> (a -> option b) -> t a -> t b
+
+val get : a ::: Type -> a -> option a -> a