packages feed

pretty-sop 0.2.0.2 → 0.2.0.3

raw patch · 3 files changed

+61/−7 lines, 3 filesdep +pretty-sopdep ~basedep ~generics-sopdep ~pretty-showPVP ok

version bump matches the API change (PVP)

Dependencies added: pretty-sop

Dependency ranges changed: base, generics-sop, pretty-show

API changes (from Hackage documentation)

Files

+ README.lhs view
@@ -0,0 +1,47 @@+## pretty-sop++[![Build Status](https://travis-ci.org/well-typed/pretty-sop.svg?branch=master)](https://travis-ci.org/well-typed/pretty-sop)+[![Hackage](https://img.shields.io/hackage/v/pretty-sop.svg)](https://hackage.haskell.org/package/pretty-sop)++This library contains a generic implementation of the `prettyVal` function+from the [pretty-show](https://hackage.haskell.org/package/pretty-show) package.+Using the pretty printer, values can easily be rendered to strings and HTML+documents in a uniform way.++This library makes use of the [generics-sop](https://github.com/well-typed/generics-sop)+package and is an example of a generic function defined in the SOP style.++This is the development repository. For releases, look on+[Hackage](https://hackage.haskell.org/package/pretty-sop).+++## Example++```haskell+{-# LANGUAGE DeriveGeneric #-}++import Generics.SOP.PrettyVal+import Generics.SOP+import qualified GHC.Generics as G+import Text.Show.Pretty+++data Car = Car+  { name :: String+  , seats :: Int+  } deriving (G.Generic)++instance Generic Car+instance HasDatatypeInfo Car+instance PrettyVal Car where+  prettyVal = gprettyVal++main :: IO ()+main = putStrLn $ dumpStr $ Car "test" 3+```++would print:++```text+Car { name = test , seats = 3 }+```
pretty-sop.cabal view
@@ -1,5 +1,5 @@ name:                pretty-sop-version:             0.2.0.2+version:             0.2.0.3 synopsis:            A generic pretty-printer using generics-sop description:   This library contains a generic implementation of the 'prettyVal'@@ -18,7 +18,7 @@ category:            Generics build-type:          Simple cabal-version:       >=1.10-tested-with:         GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1, GHC == 8.0.2, GHC == 8.1.*+tested-with:         GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5  source-repository head   type:                git@@ -26,9 +26,9 @@  library   exposed-modules:     Generics.SOP.PrettyVal-  build-depends:       base                 >= 4.6  && < 5,-                       generics-sop         >= 0.2  && < 0.4,-                       pretty-show          >= 1.6  && < 1.7+  build-depends:       base                 >= 4.6   && < 5,+                       generics-sop         >= 0.2.3 && < 0.6,+                       pretty-show          >= 1.6   && < 1.10   hs-source-dirs:      src   default-language:    Haskell2010   ghc-options:         -Wall@@ -57,3 +57,11 @@                        PolyKinds                        UndecidableInstances                        TemplateHaskell++test-suite readme+  default-language:    Haskell2010+  type:                exitcode-stdio-1.0+  main-is:             README.lhs+  ghc-options:         -pgmL markdown-unlit+  build-depends:       base, pretty-sop, generics-sop, pretty-show+  build-tool-depends:  markdown-unlit:markdown-unlit >=0.5.0 && <0.6
src/Generics/SOP/PrettyVal.hs view
@@ -31,8 +31,7 @@ gprettyVal = gprettyVal' (datatypeInfo (Proxy :: Proxy a)) . from  gprettyVal' :: (All2 PrettyVal xss, All SListI xss) => DatatypeInfo xss -> SOP I xss -> Value-gprettyVal' (ADT     _ _ cs) = gprettyVal'' cs-gprettyVal' (Newtype _ _ c)  = gprettyVal'' (c :* Nil)+gprettyVal' d = gprettyVal'' (constructorInfo d)  gprettyVal'' :: (All2 PrettyVal xss, All SListI xss) => NP ConstructorInfo xss -> SOP I xss -> Value gprettyVal'' info (SOP sop) =