From 39f23ffd9b72a75bb01dadf8e65e6817ba404ab6 Mon Sep 17 00:00:00 2001 From: Giuseppe Lomurno Date: Mon, 13 Jul 2020 02:42:24 +0200 Subject: [PATCH] Prec version of pretty interface --- libs/contrib/Text/PrettyPrint/Prettyprinter/Doc.idr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/contrib/Text/PrettyPrint/Prettyprinter/Doc.idr b/libs/contrib/Text/PrettyPrint/Prettyprinter/Doc.idr index cad9ad5c7..07987d765 100644 --- a/libs/contrib/Text/PrettyPrint/Prettyprinter/Doc.idr +++ b/libs/contrib/Text/PrettyPrint/Prettyprinter/Doc.idr @@ -351,6 +351,10 @@ Functor Doc where public export interface Pretty a where pretty : a -> Doc ann + pretty x = prettyPrec Open x + + prettyPrec : Prec -> a -> Doc ann + prettyPrec _ x = pretty x export Pretty String where @@ -652,7 +656,7 @@ layoutWadlerLeijen fits pageWidth_ doc = best 0 0 (Cons 0 doc Nil) best nl cc c@(Cons i (Column f) ds) = best nl cc $ assert_smaller c (Cons i (f cc) ds) best nl cc c@(Cons i (WithPageWidth f) ds) = best nl cc $ assert_smaller c (Cons i (f pageWidth_) ds) best nl cc c@(Cons i (Nesting f) ds) = best nl cc $ assert_smaller c (Cons i (f i) ds) - best nl cc c@(Cons i (Annotated ann x) ds) = best nl cc $ assert_smaller c (Cons i x (UndoAnn ds)) + best nl cc c@(Cons i (Annotated ann x) ds) = SAnnPush ann $ best nl cc $ assert_smaller c (Cons i x (UndoAnn ds)) ||| Layout a document with unbounded page width. export