adamc@196: datatype list a = Nil | Cons of a * list a
adamc@196: 
adamc@196: val isNil = fn t ::: Type => fn ls : list t =>
adamc@196:         case ls of Nil => True | _ => False
adamc@196: 
adamc@196: val show = fn b => if b then "True" else "False"
adamc@196: 
adamc@196: val rec delist : list string -> xml body [] [] = fn x =>
adamc@196:         case x of
adamc@196:           Nil => <body>Nil</body>
adamc@196:         | Cons (h, t) => <body>{cdata h} :: {delist t}</body>
adamc@196: 
adamc@196: val main : unit -> page = fn () => <html><body>
adamc@196:         {cdata (show (isNil (Nil : list bool)))},
adamc@196:         {cdata (show (isNil (Cons (1, Nil))))},
adamc@196:         {cdata (show (isNil (Cons ("A", Cons ("B", Nil)))))}
adamc@196: 
adamc@196:         <p>{delist (Cons ("X", Cons ("Y", Cons ("Z", Nil))))}</p>
adamc@196: </body></html>