File tree Expand file tree Collapse file tree
prettyprinter/src/Data/Text/Prettyprint/Doc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1921,6 +1921,24 @@ renderShowS = \sds -> case sds of
19211921 SAnnPush _ x -> renderShowS x
19221922 SAnnPop x -> renderShowS x
19231923
1924+ valid :: Doc ann -> Bool
1925+ valid = go False
1926+ where
1927+ go mayFail doc = case doc of
1928+ Fail -> mayFail
1929+ Empty -> True
1930+ Char c -> c /= ' \n '
1931+ Text l t -> l == T. length t && l >= 2 && T. all (/= ' \n ' ) t
1932+ Line -> True
1933+ FlatAlt x y -> go mayFail x && go mayFail y
1934+ Cat x y -> go mayFail x && go mayFail y
1935+ Nest _ x -> go mayFail x
1936+ Union x y -> go True x && go mayFail y
1937+ Column f -> all (go mayFail) (map f [0 .. 80 ])
1938+ WithPageWidth f -> all (go mayFail) (map f (Unbounded : [AvailablePerLine c r | c <- [1 .. 80 ], r <- [0 , 0.1 .. 1 ]]))
1939+ Nesting f -> all (go mayFail) (map f [0 .. 80 ])
1940+ Annotated _ x -> go mayFail x
1941+
19241942
19251943-- $setup
19261944--
You can’t perform that action at this time.
0 commit comments