diff options
author | 2009-12-12 11:02:20 -0500 | |
---|---|---|
committer | 2009-12-12 11:02:20 -0500 | |
commit | aa76848b2cfdbf3b1c61dd5ed9752713222a4828 (patch) | |
tree | ab722581146ac2de00f49743a319f6b3ccf35a6e | |
parent | 4a2970f1c3686cdef13f07b93f87adecb3721617 (diff) |
Checked-ness of radio options; Option.get
-rw-r--r-- | lib/ur/basis.urs | 2 | ||||
-rw-r--r-- | lib/ur/option.ur | 5 | ||||
-rw-r--r-- | lib/ur/option.urs | 2 |
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 |