portray-pretty 0.1.0.2 → 0.1.0.3
raw patch · 4 files changed
+38/−31 lines, 4 filesdep ~basedep ~portraydep ~textPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, portray, text
API changes (from Hackage documentation)
Files
- CHANGELOG.md +9/−5
- portray-pretty.cabal +16/−22
- src/Data/Portray/Pretty.hs +11/−3
- test/Main.hs +2/−1
CHANGELOG.md view
@@ -1,13 +1,17 @@-# 0.1.0.0+# 0.1.0.3 (2022-09-24) -Initial version.+* Update to `portray-0.3.0`. -# 0.1.0.1+# 0.1.0.2 (2021-09-17) +* Update to `portray-0.2.0`.++# 0.1.0.1 (2021-09-14)+ * Fix needless parentheses around nullary function applications. * Improve Haddock documentation. * Improve the package description and synopsis. -# 0.1.0.2+# 0.1.0.0 (2021-09-02) -* Update to portray-0.2.0+Initial version.
portray-pretty.cabal view
@@ -1,14 +1,12 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: 2f09ba9b37e58400c49ded58a06b338f5b6aab89cb1b20f9b4461e347d4a9a00 name: portray-pretty-version: 0.1.0.2-synopsis: A portray backend using the pretty package.+version: 0.1.0.3+synopsis: Portray backend for pretty description: This provides a <https://hackage.haskell.org/package/pretty pretty> backend for <https://hackage.haskell.org/package/portray portray>, along with derivable 'Text.PrettyPrint.HughesPJClass.Pretty' instances for types with@@ -17,11 +15,11 @@ See also <https://hackage.haskell.org/package/portray-prettyprinter portray-prettyprinter>. category: Text-homepage: https://github.com/google/hs-portray#readme-bug-reports: https://github.com/google/hs-portray/issues-author: Andrew Pritchard <awpr@google.com>-maintainer: Andrew Pritchard <awpr@google.com>-copyright: 2020-2021 Google LLC+homepage: https://github.com/awpr/portray#readme+bug-reports: https://github.com/awpr/portray/issues+author: Andrew Pritchard <awpritchard@gmail.com>+maintainer: Andrew Pritchard <awpritchard@gmail.com>+copyright: 2020-2021 Google LLC; 2022 Andrew Pritchard license: Apache-2.0 license-file: LICENSE build-type: Simple@@ -30,39 +28,35 @@ source-repository head type: git- location: https://github.com/google/hs-portray+ location: https://github.com/awpr/portray subdir: portray-pretty library exposed-modules: Data.Portray.Pretty- other-modules:- Paths_portray_pretty hs-source-dirs: src build-depends:- base >=4.12 && <4.16- , portray >=0.2 && <0.3- , portray-diff >=0.1 && <0.2+ base >=4.12 && <4.17+ , portray ==0.3.*+ , portray-diff ==0.1.* , pretty >=1.1.3 && <1.2- , text >=0.1 && <1.3+ , text >=0.1 && <2.1 default-language: Haskell2010 test-suite PortrayPretty-test type: exitcode-stdio-1.0 main-is: Main.hs- other-modules:- Paths_portray_pretty hs-source-dirs: test build-depends: HUnit- , base >=4.12 && <4.16+ , base >=4.12 && <4.17 , portray- , portray-diff >=0.1 && <0.2+ , portray-diff ==0.1.* , portray-pretty , pretty >=1.1.3 && <1.2 , test-framework , test-framework-hunit- , text >=0.1 && <1.3+ , text >=0.1 && <2.1 default-language: Haskell2010
src/Data/Portray/Pretty.hs view
@@ -1,4 +1,5 @@ -- Copyright 2020-2021 Google LLC+-- Copyright 2022 Andrew Pritchard -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License.@@ -106,7 +107,8 @@ import Data.Portray ( Assoc(..), Infixity(..), FactorPortrayal(..)- , Ident(..), IdentKind(..)+ , Ident(..), IdentKind(..), shouldUseScientific+ , formatFloatLit, formatIntLit, formatSpecialFloat , Portray, Portrayal(..), PortrayalF(..) , cata, portray )@@ -193,18 +195,24 @@ toDocAssocPrecF :: PortrayalF DocAssocPrec -> DocAssocPrec toDocAssocPrecF = \case NameF nm -> \_ _ -> ppPrefix nm- LitIntF x -> \_ _ -> P.text (show x)- LitRatF x -> \_ _ -> P.text (show (fromRational x :: Double))+ LitIntBaseF b x -> \_ _ -> P.text $ T.unpack $ formatIntLit b [] x++ LitFloatF x -> \_ _ ->+ P.text $ T.unpack $ formatFloatLit (shouldUseScientific x) [] x++ SpecialFloatF x -> \_ _ -> P.text $ T.unpack $ formatSpecialFloat x LitStrF x -> \_ _ -> P.text (show x) LitCharF x -> \_ _ -> P.text (show x) OpaqueF txt -> \_ _ -> P.text (T.unpack txt) ApplyF fn [] -> \_ _ -> fn AssocL 10+ ApplyF fn xs -> \lr p -> P.maybeParens (not $ fixityCompatible (Infixity AssocL 10) lr p) $ P.sep [ fn AssocL 10 , P.nest 2 $ P.sep $ xs <&> \docprec -> docprec AssocR 10 ]+ BinopF nm fx x y -> ppBinop nm fx x y TupleF xs -> \_ _ -> ppBulletList "(" "," ")" $ xs <&> \x -> x AssocNope (-1) ListF xs -> \_ _ -> ppBulletList "[" "," "]" $ xs <&> \x -> x AssocNope (-1)
test/Main.hs view
@@ -1,4 +1,5 @@ -- Copyright 2021 Google LLC+-- Copyright 2022 Andrew Pritchard -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License.@@ -63,7 +64,7 @@ "5 :| []" , testCase "con" $- prettyShowPortrayal + prettyShowPortrayal (Binop (Ident ConIdent "InfixCon") (infixl_ 9)