fmt 0.6.2.0 → 0.6.3.0
raw patch · 4 files changed
+27/−1 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Fmt: GenericBuildable :: a -> GenericBuildable a
+ Fmt: newtype GenericBuildable a
+ Fmt.Internal.Generic: GenericBuildable :: a -> GenericBuildable a
+ Fmt.Internal.Generic: instance (Fmt.Internal.Generic.GBuildable (GHC.Generics.Rep a), GHC.Generics.Generic a) => Formatting.Buildable.Buildable (Fmt.Internal.Generic.GenericBuildable a)
+ Fmt.Internal.Generic: newtype GenericBuildable a
Files
- CHANGELOG.md +4/−0
- fmt.cabal +1/−1
- lib/Fmt.hs +1/−0
- lib/Fmt/Internal/Generic.hs +21/−0
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.6.3.0++* Add support for `deriving ... via GenericBuildable T`+ # 0.6.2.0 * Cleared `hspec` upper bound
fmt.cabal view
@@ -1,5 +1,5 @@ name: fmt-version: 0.6.2.0+version: 0.6.3.0 synopsis: A new formatting library description: A new formatting library that tries to be simple to understand while still
lib/Fmt.hs view
@@ -120,6 +120,7 @@ -- ** Generic formatting genericF,+ GenericBuildable(..), ) where
lib/Fmt/Internal/Generic.hs view
@@ -65,6 +65,27 @@ genericF :: (Generic a, GBuildable (Rep a)) => a -> Builder genericF = gbuild . from +{- | A newtype for deriving a generic 'Buildable' instance for any type+using @DerivingVia@.++>>> :set -XDerivingVia+>>> :{+data Bar = Bar { x :: Bool, y :: [Int] }+ deriving stock Generic+ deriving Buildable via GenericBuildable Bar+:}++>>> pretty (Bar True [1,2,3])+Bar:+ x: True+ y: [1, 2, 3]++-}+newtype GenericBuildable a = GenericBuildable a++instance (GBuildable (Rep a), Generic a) => Buildable (GenericBuildable a) where+ build (GenericBuildable a) = genericF a+ ---------------------------------------------------------------------------- -- GBuildable ----------------------------------------------------------------------------