GenericPretty 1.1.7 → 1.1.8
raw patch · 4 files changed
+24/−19 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- GenericPretty.cabal +1/−1
- README +3/−3
- Text/PrettyPrint/GenericPretty.hs +19/−14
- Text/PrettyPrint/MyPretty.hs +1/−1
GenericPretty.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented. -Version: 1.1.7 +Version: 1.1.8 -- A short (one-line) description of the package. Synopsis: A generic, derivable, haskell pretty printer.
README view
@@ -55,9 +55,9 @@ The package is installed in the same way as any other package. The steps are: 0. Make sure you have a version of ghc >= 7.2 installed and that you can use the 'runhaskell' command from the command line. - 1. Download and unpack "GenericPretty-1.1.7.tar.gz" + 1. Download and unpack "GenericPretty-1.1.8.tar.gz" 2. Move to the correct directory: - $ cd GenericPretty-1.1.7 + $ cd GenericPretty-1.1.8 3. Run the following haskell commands to install the library globally: $ runhaskell Setup configure $ runhaskell Setup build @@ -253,7 +253,7 @@ examples integrated with QuickCheck can be found in 'TestSuite/Tests.hs'. Further information can be found in the API: - http://hackage.haskell.org/packages/archive/GenericPretty/1.1.7/doc/html/Text-PrettyPrint-GenericPretty.html + http://hackage.haskell.org/packages/archive/GenericPretty/1.1.8/doc/html/Text-PrettyPrint-GenericPretty.html and in the source code itself. ===============================================================================
Text/PrettyPrint/GenericPretty.hs view
@@ -12,7 +12,7 @@ For examples of usage please see the README file included in the package. - For more information see the HackageDB project page: <http://hackage.haskell.org/package/GenericPretty-1.1.7> + For more information see the HackageDB project page: <http://hackage.haskell.org/package/GenericPretty-1.1.8> -} module Text.PrettyPrint.GenericPretty @@ -273,17 +273,18 @@ -- | 'fullPP' is a fully customizable Pretty Printer -- -- Every other pretty printer just gives some default values to 'fullPP' -fullPP :: (Out a) => - (TextDetails -> b -> b) -- ^Function that handles the text conversion /(eg: 'outputIO')/ - -> b -- ^The end element of the result /( eg: "" or putChar('\n') )/ - -> Style -- ^The pretty printing 'Text.PrettyPrint.MyPretty.Style' to use - -> a -- ^The value to pretty print - -> b -- ^The pretty printed result - +fullPP :: (Out a) => (TextDetails -> b -> b) -- ^Function that handles the text conversion /(eg: 'outputIO')/ + -> b -- ^The end element of the result /( eg: "" or putChar('\n') )/ + -> Style -- ^The pretty printing 'Text.PrettyPrint.MyPretty.Style' to use + -> a -- ^The value to pretty print + -> b -- ^The pretty printed result fullPP td end s a = fullRender (mode s) (lineLength s) (ribbonsPerLine s) td end doc where doc = docPrec 0 a +defaultStyle :: Style +defaultStyle = Style {mode = PageMode, lineLength = 80, ribbonsPerLine = 1.5} + -- | Utility function that handles the text conversion for 'fullPP'. -- -- 'outputIO' transforms the text into 'String's and outputs it directly. @@ -334,11 +335,13 @@ -- | The default pretty printer returning 'String's -- --- Uses the default 'Text.PrettyPrint.MyPretty.Style', called 'style. Equivalent to +-- Equivalent to -- --- > prettyStyle style +-- > prettyStyle defaultStyle +-- +-- Where defaultStyle = (mode=PageMode, lineLength=80, ribbonsPerLine=1.5) pretty :: (Out a) => a -> String -pretty = prettyStyle style +pretty = prettyStyle defaultStyle -- | Customizable pretty printer. -- @@ -363,11 +366,13 @@ -- | The default Pretty Printer, -- --- Uses the default 'Text.PrettyPrint.MyPretty.Style', called 'style'. Equivalent to +-- Equivalent to: -- --- > ppStyle style +-- > ppStyle defaultStyle +-- +-- Where defaultStyle = (mode=PageMode, lineLength=80, ribbonsPerLine=1.5) pp :: (Out a) => a -> IO() -pp = ppStyle style +pp = ppStyle defaultStyle -- define some instances of Out making sure to generate output identical to 'show' modulo the extra whitespace
Text/PrettyPrint/MyPretty.hs view
@@ -42,7 +42,7 @@ decode (Chr c) = [c] decode (Str s) = s --- | The default 'Style' used for "Text.PrettyPrint.GenericPretty" +-- | The default 'Syle' -- (mode=PageMode, lineLength=80, ribbonsPerLine=1.5) style :: Style style = Style {mode = PageMode, lineLength = 80, ribbonsPerLine = 1.5}