gdritter repos s-cargot / 71d2ec8
Fix indentation in basicPrint algorithm Getty Ritter 6 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Collapse all Expand all
145145 -- final improper element (if it exists)
146146 | IEmpty
147147 -- ^ An empty list
148 deriving Show
148149
149150 sizeOf :: Intermediate -> Size
150151 sizeOf IEmpty = Size 2 2
151152 sizeOf (IAtom t) = Size len len where len = T.length t
152 sizeOf (IList _ s _ _ _) = s
153 sizeOf (IList _ (Size n m) _ _ _) = Size (n + 2) (m + 2)
153154
154155 concatSize :: Size -> Size -> Size
155156 concatSize l r = Size
348349 Seq.EmptyL -> ""
349350 t Seq.:< ts
350351 | F.null ts -> t
351 | otherwise -> t <> " " <> joinLinesS ts
352 | otherwise -> t <> " " <> unwordsS ts
352353
353354
354355 -- Indents every line n spaces, and adds a newline to the beginning
355356 -- used in swung indents
356357 indentAllS :: Int -> Seq.Seq B.Builder -> B.Builder
357358 indentAllS n = ("\n" <>) . joinLinesS . fmap (indent n)
358
359359
360360 -- Indents every line but the first by some amount
361361 -- used in aligned indents