matchable-th 0.1.2.0 → 0.1.2.1
raw patch · 4 files changed
+50/−8 lines, 4 filesdep ~template-haskellPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: template-haskell
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- README.md +19/−5
- matchable-th.cabal +5/−3
- test/th.hs +21/−0
CHANGELOG.md view
@@ -1,3 +1,8 @@+# 0.1.2.1++- Require cabal-version: 2.0+- The library itself is unchanged. Update of the test code only.+ # 0.1.2.0 - Fail correctly, with appropriate error message, when deriving Matchable
README.md view
@@ -4,7 +4,7 @@ generate instances of `Matchable` and `Bimatchable` type classes, which are from `matchable` package. -### Example+### Examples ``` haskell {-# LANGUAGE DeriveFunctor #-}@@ -36,23 +36,37 @@ -- Most simple case data BiF a b = BiF0 | BiF1 a b+ deriving (Show, Eq) +$(deriveBimatchable ''BiF)++instance Eq a => Eq1 (BiF a) where+ liftEq = liftEq2Default (==)+ instance Eq2 BiF where liftEq2 = liftEq2Default +instance Functor (BiF a) where+ fmap = bimapRecovered id+ instance Bifunctor BiF where bimap = bimapRecovered -$(deriveBimatchable ''BiF)- -- Test case for using [], tuple, and another Bimatchable instance data BiG a b = BiG0 | BiG1 [a] [b] | BiG2 (Int, BiF a b)+ deriving (Show, Eq) +$(deriveBimatchable ''BiG)++instance Eq a => Eq1 (BiG a) where+ liftEq = liftEq2Default (==)+ instance Eq2 BiG where liftEq2 = liftEq2Default +instance Functor (BiG a) where+ fmap = bimapRecovered id+ instance Bifunctor BiG where bimap = bimapRecovered--$(deriveBimatchable ''BiG) ```
matchable-th.cabal view
@@ -1,5 +1,5 @@ name: matchable-th-version: 0.1.2.0+version: 0.1.2.1 synopsis: Generates Matchable instances using TemplateHaskell description: This package provides TemplateHaskell function to generate instances of @Matchable@ and @Bimatchable@ type classes,@@ -10,8 +10,10 @@ maintainer: viercc@gmail.com category: Functors build-type: Simple-extra-source-files: README.md, CHANGELOG.md+extra-source-files: README.md+extra-doc-files: CHANGELOG.md cabal-version: 2.0+tested-with: GHC ==9.0.2, GHC ==9.2.7, GHC ==9.4.4, GHC ==9.6.1 source-repository head type: git@@ -23,7 +25,7 @@ exposed-modules: Data.Matchable.TH build-depends: base >= 4.10 && <5, matchable >= 0.1.2,- template-haskell >= 2.4 && < 2.18,+ template-haskell >= 2.4 && < 2.21, th-abstraction >= 0.4.0.0 ghc-options: -Wall default-language: Haskell2010
test/th.hs view
@@ -79,33 +79,54 @@ -- Most simple case data BiF a b = BiF0 | BiF1 a b+ deriving (Show, Eq) $(deriveBimatchable ''BiF) +instance Eq a => Eq1 (BiF a) where+ liftEq = liftEq2Default (==)+ instance Eq2 BiF where liftEq2 = liftEq2Default +instance Functor (BiF a) where+ fmap = bimapRecovered id+ instance Bifunctor BiF where bimap = bimapRecovered -- Test case for using [], tuple, and another Bimatchable instance data BiG a b = BiG0 | BiG1 [a] [b] | BiG2 (Int, BiF a b)+ deriving (Show, Eq) $(deriveBimatchable ''BiG) +instance Eq a => Eq1 (BiG a) where+ liftEq = liftEq2Default (==)+ instance Eq2 BiG where liftEq2 = liftEq2Default +instance Functor (BiG a) where+ fmap = bimapRecovered id+ instance Bifunctor BiG where bimap = bimapRecovered -- Test case for recursive type data BiH a b = BiH1 a b | BiH2 (BiH b a) (BiH a String)+ deriving (Show, Eq) $(deriveBimatchable ''BiH) +instance Eq a => Eq1 (BiH a) where+ liftEq = liftEq2Default (==)+ instance Eq2 BiH where liftEq2 = liftEq2Default++instance Functor (BiH a) where+ fmap = bimapRecovered id instance Bifunctor BiH where bimap = bimapRecovered