File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
prettyprinter/src/Data/Text/Prettyprint/Doc Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1883,6 +1883,24 @@ renderShowS = \sds -> case sds of
18831883 SAnnPush _ x -> renderShowS x
18841884 SAnnPop x -> renderShowS x
18851885
1886+ valid :: Doc ann -> Bool
1887+ valid = go False
1888+ where
1889+ go mayFail doc = case doc of
1890+ Fail -> mayFail
1891+ Empty -> True
1892+ Char c -> c /= ' \n '
1893+ Text l t -> l == T. length t && l >= 2 && T. all (/= ' \n ' ) t
1894+ Line -> True
1895+ FlatAlt x y -> go mayFail x && go mayFail y
1896+ Cat x y -> go mayFail x && go mayFail y
1897+ Nest _ x -> go mayFail x
1898+ Union x y -> go True x && go mayFail y
1899+ Column f -> all (go mayFail) (map f [0 .. 80 ])
1900+ WithPageWidth f -> all (go mayFail) (map f (Unbounded : [AvailablePerLine c r | c <- [1 .. 80 ], r <- [0 , 0.1 .. 1 ]]))
1901+ Nesting f -> all (go mayFail) (map f [0 .. 80 ])
1902+ Annotated _ x -> go mayFail x
1903+
18861904
18871905-- $setup
18881906--
You can’t perform that action at this time.
0 commit comments