datatype color = Red | White | Blue fun c2s c = case c of Red => "Red" | White => "White" | Blue => "Blue" val show_color = mkShow c2s datatype list a = Nil | Cons of a * list a fun isNil (t ::: Type) (ls : list t) = case ls of Nil => True | _ => False fun delist (ls : list string) : xml body [] [] = case ls of Nil => Nil | Cons (h, t) => {[h]} :: {delist t} fun main () : transaction page = sInt <- source 0; sFloat <- source 1.23; sBoth <- source (7, 42.1); sOpt <- source None; sBool <- source True; sColor <- source White; sList <- source Nil; return {[n + 3]}}/> Change
{[n + 1.0]}}/> Change
{[p.1]}, {[p.2]}}/>; return Initial | (fst, snd) => return {[fst]}, {[snd]}}/> Change
return None | Some n => return {[n]}}/> Change
{[b]}}/> Yes else return No}/> Change
{[c]}}/> Red White Blue
{[isNil ls]}}/>; {delist ls}}/> Change