Fix indentation in basicPrint algorithm
Getty Ritter
6 years ago
145 | 145 | -- final improper element (if it exists) |
146 | 146 | | IEmpty |
147 | 147 | -- ^ An empty list |
148 | deriving Show | |
148 | 149 | |
149 | 150 | sizeOf :: Intermediate -> Size |
150 | 151 | sizeOf IEmpty = Size 2 2 |
151 | 152 | sizeOf (IAtom t) = Size len len where len = T.length t |
152 |
sizeOf (IList _ |
|
153 | sizeOf (IList _ (Size n m) _ _ _) = Size (n + 2) (m + 2) | |
153 | 154 | |
154 | 155 | concatSize :: Size -> Size -> Size |
155 | 156 | concatSize l r = Size |
348 | 349 | Seq.EmptyL -> "" |
349 | 350 | t Seq.:< ts |
350 | 351 | | F.null ts -> t |
351 |
| otherwise -> t <> " " <> |
|
352 | | otherwise -> t <> " " <> unwordsS ts | |
352 | 353 | |
353 | 354 | |
354 | 355 | -- Indents every line n spaces, and adds a newline to the beginning |
355 | 356 | -- used in swung indents |
356 | 357 | indentAllS :: Int -> Seq.Seq B.Builder -> B.Builder |
357 | 358 | indentAllS n = ("\n" <>) . joinLinesS . fmap (indent n) |
358 | ||
359 | 359 | |
360 | 360 | -- Indents every line but the first by some amount |
361 | 361 | -- used in aligned indents |