module Drasil.FileHandling.Legacy.Document (blank, indent, indentList, contSep,
listToDoc, Separator) where
import Text.PrettyPrint.HughesPJ (Doc, text, vcat, nest, hsep, comma, punctuate)
type Separator = Doc
contSep :: Separator
contSep :: Separator
contSep = String -> Separator
text String
"\n"
blank :: Doc
blank :: Separator
blank = String -> Separator
text String
""
indent :: Doc -> Doc
indent :: Separator -> Separator
indent = Int -> Separator -> Separator
nest Int
4
indentList :: [Doc] -> Doc
indentList :: [Separator] -> Separator
indentList = Separator -> Separator
indent (Separator -> Separator)
-> ([Separator] -> Separator) -> [Separator] -> Separator
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Separator] -> Separator
vcat
listToDoc :: [String] -> Doc
listToDoc :: [String] -> Separator
listToDoc = [Separator] -> Separator
hsep ([Separator] -> Separator)
-> ([String] -> [Separator]) -> [String] -> Separator
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Separator -> [Separator] -> [Separator]
punctuate Separator
comma ([Separator] -> [Separator])
-> ([String] -> [Separator]) -> [String] -> [Separator]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> Separator) -> [String] -> [Separator]
forall a b. (a -> b) -> [a] -> [b]
map String -> Separator
text