adamc@728: datatype lines = End | Line of string * source lines adamc@728: adamc@728: type t = { Head : source lines, Tail : source (source lines) } adamc@728: adamc@728: val create = adamc@728: head <- source End; adamc@728: tail <- source head; adamc@728: return {Head = head, Tail = tail} adamc@728: adamc@728: fun renderL lines = adamc@728: case lines of adamc@728: End => adamc@728: | Line (line, linesS) => {[line]}
adamc@728: adamc@728: and renderS linesS = adamc@728: lines <- signal linesS; adamc@728: return (renderL lines) adamc@728: adamc@728: fun render t = renderS t.Head adamc@728: adamc@728: fun write t s = adamc@728: oldTail <- get t.Tail; adamc@728: newTail <- source End; adamc@728: set oldTail (Line (s, newTail)); adamc@728: set t.Tail newTail