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