Conversation
|
If I cause the fusion tests to fail, for example with --- a/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs
+++ b/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs
@@ -551,7 +551,7 @@ changesUponFlattening :: Doc ann -> Maybe (Doc ann)
changesUponFlattening = \doc -> case doc of
FlatAlt _ y -> Just (flatten y)
Line -> Just Fail
- Union x _ -> changesUponFlattening x <|> Just x
+ Union x _ -> Nothing
Nest i x -> fmap (Nest i) (changesUponFlattening x)
Annotated ann x -> fmap (Annotated ann) (changesUponFlattening x)… I think what could help is to filter the raw Such a |
| Nest _ x -> go mayFail x | ||
| Union x y -> go True x && go mayFail y | ||
| Column f -> all (go mayFail) (map f [0..80]) | ||
| WithPageWidth f -> all (go mayFail) (map f (Unbounded : [AvailablePerLine c r | c <- [1..80], r <- [0, 0.1 .. 1]])) |
There was a problem hiding this comment.
Is 0 a valid ribbon width at all? Not sure how to interpret the docs there:
| WithPageWidth f -> all (go mayFail) (map f (Unbounded : [AvailablePerLine c r | c <- [1..80], r <- [0, 0.1 .. 1]])) | |
| WithPageWidth f -> all (go mayFail) (map f (Unbounded : [AvailablePerLine c r | c <- [1..80], r <- [0.1, 0.2 .. 1]])) |
| Cat x y -> go mayFail x && go mayFail y | ||
| Nest _ x -> go mayFail x | ||
| Union x y -> go True x && go mayFail y | ||
| Column f -> all (go mayFail) (map f [0..80]) |
There was a problem hiding this comment.
Not sure how to best handle these functions. Checking them exhaustively would take too long. Even the current check with "typical" values 0..80 seems excessive.
9be59a9 to
f27ae11
Compare
| shrink doc = filter valid $ case doc of | ||
| Fail -> [Empty] | ||
| Empty -> [] | ||
| Char c -> Empty : map Char (filter (/= '\n') (shrink c)) |
There was a problem hiding this comment.
Might be one of the few places where a list comprehension is nicer to read! :-)
No description provided.