module Utils.Drasil.Document (blank, indent, indentList, contSep, filterEmpty,
listToDoc, Separator) where
import Text.PrettyPrint.HughesPJ
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 forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Separator] -> Separator
vcat
filterEmpty :: [Doc] -> [Doc]
filterEmpty :: [Separator] -> [Separator]
filterEmpty = forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not forall b c a. (b -> c) -> (a -> b) -> a -> c
. Separator -> Bool
isEmpty)
listToDoc :: [String] -> Doc
listToDoc :: [String] -> Separator
listToDoc = [Separator] -> Separator
hsep forall b c a. (b -> c) -> (a -> b) -> a -> c
. Separator -> [Separator] -> [Separator]
punctuate Separator
comma forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (a -> b) -> [a] -> [b]
map String -> Separator
text