changeset 1068:757dbac0454d

Checked-ness of radio options; Option.get
author Adam Chlipala <adamc@hcoop.net>
date Sat, 12 Dec 2009 11:02:20 -0500
parents 50dd937c4cb9
children 757397bb9609
files lib/ur/basis.urs lib/ur/option.ur lib/ur/option.urs
diffstat 3 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ur/basis.urs	Thu Dec 10 15:46:07 2009 -0500
+++ b/lib/ur/basis.urs	Sat Dec 12 11:02:20 2009 -0500
@@ -680,7 +680,7 @@
 
 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)
--- a/lib/ur/option.ur	Thu Dec 10 15:46:07 2009 -0500
+++ b/lib/ur/option.ur	Sat Dec 12 11:02:20 2009 -0500
@@ -38,3 +38,8 @@
     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
--- a/lib/ur/option.urs	Thu Dec 10 15:46:07 2009 -0500
+++ b/lib/ur/option.urs	Sat Dec 12 11:02:20 2009 -0500
@@ -8,3 +8,5 @@
 
 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