adamc@398: open List
adamc@398:
adamc@386: functor Make(M : sig
adamc@386: type t
adamc@398: val toString : t -> string
adamc@398: val fromString : string -> option t
adamc@386: end) = struct
adamc@398: fun toXml (ls : list M.t) =
adamc@398: case ls of
adamc@398: Nil => []
adamc@398: | Cons (x, ls') => {[M.toString x]} :: {toXml ls'}
adamc@398:
adamc@398: fun console (ls : list M.t) = return
adamc@398: Current list: {toXml ls}
adamc@400: Reversed list: {toXml (rev ls)}
adamc@399: Length: {[length ls]}
adamc@399:
adamc@398:
adamc@398:
adamc@398:
adamc@398:
adamc@398: and cons (ls : list M.t) (r : {X : string}) =
adamc@398: case M.fromString r.X of
adamc@398: None => return Invalid string!
adamc@398: | Some v => console (Cons (v, ls))
adamc@398:
adamc@398: fun main () = console Nil
adamc@386: end