fix issue in prettier

This commit is contained in:
2024-07-11 22:17:29 -07:00
parent a4d851b563
commit b37fa56c70
4 changed files with 33 additions and 14 deletions

View File

@@ -35,12 +35,13 @@ layout (TEXT str x) = str ++ layout x
||| Whether a documents first line fits.
fits : Nat -> DOC -> Bool
fits w x = if w < 0 then False else case x of
fits w x = if w == 0 then False else case x of
EMPTY => True
(LINE k x) => True
(TEXT s x) => fits (w `minus` length s) x
better : Nat -> Nat -> DOC -> DOC -> DOC
-- The lazy is important
better : Nat -> Nat -> DOC -> Lazy DOC -> DOC
better w k x y = if fits (w `minus` k) x then x else y
be : Nat -> Nat -> List (Nat, Doc) -> DOC