pretty 1.1.1.1 → 1.1.1.2
raw patch · 4 files changed
+33/−7 lines, 4 filesdep +deepseqdep ~base
Dependencies added: deepseq
Dependency ranges changed: base
Files
- CHANGELOG.md +4/−0
- README.md +4/−3
- pretty.cabal +3/−2
- src/Text/PrettyPrint/HughesPJ.hs +22/−2
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Pretty library change log +## 1.1.1.2 -- 18th August, 2014++* Add NFData and Eq instances (by Ivan Lazar Miljenovic)+ ## 1.1.1.1 * Update pretty cabal file and readme.
README.md view
@@ -5,9 +5,10 @@ This is useful for compilers and related tools. It is based on the pretty-printer outlined in the paper 'The Design-of a Pretty-printing Library' in Advanced Functional Programming,-Johan Jeuring and Erik Meijer (eds), LNCS 925-<http://www.cs.chalmers.se/~rjmh/Papers/pretty.ps>+of a Pretty-printing Library' by John Hughes in Advanced Functional+Programming, 1995. It can be found+[here](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.38.8777).+ ## Licensing
pretty.cabal view
@@ -1,5 +1,5 @@ name: pretty-version: 1.1.1.1+version: 1.1.1.2 synopsis: Pretty-printing library description: This package contains a pretty-printing library, a set of API's@@ -30,7 +30,8 @@ exposed-modules: Text.PrettyPrint Text.PrettyPrint.HughesPJ- build-depends: base >= 3 && < 5+ build-depends: base >= 3 && < 5,+ deepseq >= 1.1 && < 1.4 extensions: CPP, BangPatterns ghc-options: -Wall -fwarn-tabs
src/Text/PrettyPrint/HughesPJ.hs view
@@ -75,8 +75,10 @@ ) where #endif -import Data.Monoid ( Monoid(mempty, mappend) )-import Data.String ( IsString(fromString) )+import Control.DeepSeq ( NFData(rnf) )+import Data.Function ( on )+import Data.Monoid ( Monoid(mempty, mappend) )+import Data.String ( IsString(fromString) ) -- --------------------------------------------------------------------------- -- The Doc calculus@@ -235,6 +237,24 @@ showsPrec _ doc cont = fullRender (mode style) (lineLength style) (ribbonsPerLine style) txtPrinter cont doc++instance Eq Doc where+ (==) = (==) `on` render++instance NFData Doc where+ rnf Empty = ()+ rnf (NilAbove d) = rnf d+ rnf (TextBeside td i d) = rnf td `seq` rnf i `seq` rnf d+ rnf (Nest k d) = rnf k `seq` rnf d+ rnf (Union ur ul) = rnf ur `seq` rnf ul+ rnf NoDoc = ()+ rnf (Beside ld s rd) = rnf ld `seq` rnf s `seq` rnf rd+ rnf (Above ud s ld) = rnf ud `seq` rnf s `seq` rnf ld++instance NFData TextDetails where+ rnf (Chr c) = rnf c+ rnf (Str str) = rnf str+ rnf (PStr str) = rnf str -- --------------------------------------------------------------------------- -- Values and Predicates on GDocs and TextDetails