prettyprinter 1.1.0.1 → 1.1.1
raw patch · 6 files changed
+25/−14 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Text.Prettyprint.Doc.Render.Util.Panic: panicPeekedEmpty :: void
+ Data.Text.Prettyprint.Doc.Render.Util.Panic: panicPoppedEmpty :: void
- Data.Text.Prettyprint.Doc.Render.Util.Panic: panicInputNotFullyConsumed :: a
+ Data.Text.Prettyprint.Doc.Render.Util.Panic: panicInputNotFullyConsumed :: void
- Data.Text.Prettyprint.Doc.Render.Util.Panic: panicSimpleDocTreeConversionFailed :: a
+ Data.Text.Prettyprint.Doc.Render.Util.Panic: panicSimpleDocTreeConversionFailed :: void
- Data.Text.Prettyprint.Doc.Render.Util.Panic: panicUncaughtFail :: a
+ Data.Text.Prettyprint.Doc.Render.Util.Panic: panicUncaughtFail :: void
- Data.Text.Prettyprint.Doc.Render.Util.Panic: panicUnpairedPop :: a
+ Data.Text.Prettyprint.Doc.Render.Util.Panic: panicUnpairedPop :: void
Files
- README.md +1/−1
- app/GenerateReadme.hs +1/−2
- prettyprinter.cabal +1/−1
- src/Data/Text/Prettyprint/Doc/Render/Tutorials/StackMachineTutorial.hs +5/−1
- src/Data/Text/Prettyprint/Doc/Render/Util/Panic.hs +11/−4
- src/Data/Text/Prettyprint/Doc/Render/Util/StackMachine.hs +6/−5
README.md view
@@ -6,7 +6,7 @@ ==================================== [](https://travis-ci.org/quchen/prettyprinter) -[](https://github.com/quchen/prettyprinter/releases) [](https://hackage.haskell.org/package/prettyprinter) [](https://www.stackage.org/package/prettyprinter) [](https://www.stackage.org/package/prettyprinter)+[](https://hackage.haskell.org/package/prettyprinter) [](https://www.stackage.org/package/prettyprinter) [](https://www.stackage.org/package/prettyprinter)
app/GenerateReadme.hs view
@@ -33,8 +33,7 @@ [ "[](https://travis-ci.org/quchen/prettyprinter)" , " " <> hardline -- Awkwardly enough, two trailing spaces are a small break in Markdown. , hsep- [ "[](https://github.com/quchen/prettyprinter/releases)"- , "[](https://hackage.haskell.org/package/prettyprinter)"+ [ "[](https://hackage.haskell.org/package/prettyprinter)" , "[](https://www.stackage.org/package/prettyprinter)" , "[](https://www.stackage.org/package/prettyprinter)" ]]
prettyprinter.cabal view
@@ -1,5 +1,5 @@ name: prettyprinter-version: 1.1.0.1+version: 1.1.1 cabal-version: >= 1.10 category: User Interfaces, Text synopsis: A modern, easy to use, well-documented, extensible prettyprinter.
src/Data/Text/Prettyprint/Doc/Render/Tutorials/StackMachineTutorial.hs view
@@ -2,6 +2,8 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} +{-# OPTIONS_GHC -fno-warn-deprecations #-}+ #include "version-compatibility-macros.h" -- | This module shows how to write a custom prettyprinter backend, based on@@ -15,7 +17,9 @@ -- -- The module is written to be readable top-to-bottom in both Haddock and raw -- source form.-module Data.Text.Prettyprint.Doc.Render.Tutorials.StackMachineTutorial (+module Data.Text.Prettyprint.Doc.Render.Tutorials.StackMachineTutorial+ {-# DEPRECATED "Writing your own stack machine is probably more efficient and customizable; also consider using »renderSimplyDecorated(A)« instead" #-}+ ( module Data.Text.Prettyprint.Doc.Render.Tutorials.StackMachineTutorial ) where
src/Data/Text/Prettyprint/Doc/Render/Util/Panic.hs view
@@ -3,29 +3,36 @@ panicUnpairedPop, panicSimpleDocTreeConversionFailed, panicInputNotFullyConsumed,+ panicPeekedEmpty,+ panicPoppedEmpty, ) where -- | Raise a hard 'error' if there is a 'Data.Text.Prettyprint.Doc.SFail' in a -- 'Data.Text.Prettyprint.Doc.SimpleDocStream'.-panicUncaughtFail :: a+panicUncaughtFail :: void panicUncaughtFail = error ("»SFail« must not appear in a rendered »SimpleDocStream«. This is a bug in the layout algorithm! " ++ report) -- | Raise a hard 'error' when an annotation terminator is encountered in an -- unannotated region.-panicUnpairedPop :: a+panicUnpairedPop :: void panicUnpairedPop = error ("An unpaired style terminator was encountered. This is a bug in the layout algorithm! " ++ report) -- | Raise a hard generic 'error' when the -- 'Data.Text.Prettyprint.Doc.SimpleDocStream' to -- 'Data.Text.Prettyprint.Doc.Render.Util.SimpleDocTree.SimpleDocTree' conversion fails.-panicSimpleDocTreeConversionFailed :: a+panicSimpleDocTreeConversionFailed :: void panicSimpleDocTreeConversionFailed = error ("Conversion from SimpleDocStream to SimpleDocTree failed! " ++ report) -- | Raise a hard 'error' when the »to -- 'Data.Text.Prettyprint.Doc.Render.Util.SimpleDocTree.SimpleDocTree'« parser finishes -- without consuming the full input.-panicInputNotFullyConsumed :: a+panicInputNotFullyConsumed :: void panicInputNotFullyConsumed = error ("Conversion from SimpleDocStream to SimpleDocTree left unconsumed input! " ++ report) report :: String report = "Please report this as a bug"++panicPeekedEmpty, panicPoppedEmpty :: void+(panicPeekedEmpty, panicPoppedEmpty) = (mkErr "Peeked", mkErr "Popped")+ where+ mkErr x = error (x ++ " an empty style stack! Please report this as a bug.")
src/Data/Text/Prettyprint/Doc/Render/Util/StackMachine.hs view
@@ -5,9 +5,9 @@ #include "version-compatibility-macros.h" --- | Definitions to write renderers based on looking at a 'SimpleDocStream' as an--- instruction tape for a stack machine: text is written, annotations are added--- (pushed) and later removed (popped).+-- | Definitions to write renderers based on looking at a 'SimpleDocStream' as+-- an instruction tape for a stack machine: text is written, annotations are+-- added (pushed) and later removed (popped). module Data.Text.Prettyprint.Doc.Render.Util.StackMachine ( -- * Simple, pre-defined stack machines@@ -111,6 +111,7 @@ -- The @output@ type is used to append data chunks to, the @style@ is the member -- of a stack of styles to model nested styles with. newtype StackMachine output style a = StackMachine ([style] -> (a, output, [style]))+{-# DEPRECATED StackMachine "Writing your own stack machine is probably more efficient and customizable; also consider using »renderSimplyDecorated(A)« instead" #-} instance Functor (StackMachine output style) where fmap f (StackMachine r) = StackMachine (\s ->@@ -146,7 +147,7 @@ unsafePopStyle :: Monoid output => StackMachine output style style unsafePopStyle = StackMachine (\case x:xs -> (x, mempty, xs)- [] -> error "Popped an empty style stack! Please report this as a bug.")+ [] -> panicPoppedEmpty ) -- | View the topmost style, but do not modify the stack. --@@ -154,7 +155,7 @@ unsafePeekStyle :: Monoid output => StackMachine output style style unsafePeekStyle = StackMachine (\styles -> case styles of x:_ -> (x, mempty, styles)- [] -> error "Peeked an empty style stack! Please report this as a bug.")+ [] -> panicPeekedEmpty ) -- | Append a value to the output end. writeOutput :: output -> StackMachine output style ()