src/Tools/Haskell/Buffer.hs
author wenzelm
Sat, 03 Nov 2018 20:00:45 +0100
changeset 69226 68f5dc2275ac
parent 69225 bf2fecda8383
child 69227 71b48b749836
permissions -rw-r--r--
tuned whitespace;

{- GENERATED by Isabelle! -}

{-  Title:      Tools/Haskell/Buffer.hs
    Author:     Makarius
    LICENSE:    BSD 3-clause (Isabelle)

Efficient text buffers.
-}

module Isabelle.Buffer (T, empty, add, content)
where

newtype T = Buffer [String]

empty :: T
empty = Buffer []

add :: String -> T -> T
add "" buf = buf
add x (Buffer xs) = Buffer (x : xs)

content :: T -> String
content (Buffer xs) = concat (reverse xs)