-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoggle.urs
25 lines (20 loc) · 1004 Bytes
/
toggle.urs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(* Simple toggling of user-specific Boolean flags *)
type xbody' = xml [Body] [] []
functor Make(M : sig
con user :: Name
con flag :: Name
con others :: {Type}
constraint [user] ~ [flag]
constraint [user, flag] ~ others
table t : ([user = string, flag = bool] ++ others)
val whoami : transaction (option string)
(* Which user is logged in? *)
(* Text to show, as a heading and as a button label, depending on the flag value *)
val trueHeadingText : xbody
val trueButtonText : xbody'
val falseHeadingText : xbody
val falseButtonText : xbody'
(* Callbacks for when flags change *)
val onRsvp : string -> transaction unit
val onUnrsvp : string -> transaction unit
end) : Ui.S where type input = string (* username *)