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