invariant 0.6 → 0.6.1
raw patch · 3 files changed
+33/−14 lines, 3 filesdep ~template-haskelldep ~th-abstractionPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: template-haskell, th-abstraction
API changes (from Hackage documentation)
- Data.Functor.Invariant: instance Data.Functor.Invariant.Invariant Data.Semigroup.Option
Files
- CHANGELOG.md +3/−0
- invariant.cabal +8/−6
- src/Data/Functor/Invariant/TH.hs +22/−8
CHANGELOG.md view
@@ -1,3 +1,6 @@+# 0.6.1 [2023.02.27]+* Support `th-abstraction-0.5.*`.+ # 0.6 [2022.07.03] * Loosen the `Monad` constraint in the `Invariant(2)` instances for `Kleisli` to an `Invariant` constraint.
invariant.cabal view
@@ -1,5 +1,5 @@ name: invariant-version: 0.6+version: 0.6.1 synopsis: Haskell98 invariant functors description: Haskell98 invariant functors (also known as exponential functors). .@@ -28,8 +28,10 @@ , GHC == 8.6.5 , GHC == 8.8.4 , GHC == 8.10.7- , GHC == 9.0.1- , GHC == 9.2.1+ , GHC == 9.0.2+ , GHC == 9.2.6+ , GHC == 9.4.4+ , GHC == 9.6.1 extra-source-files: CHANGELOG.md, README.md source-repository head@@ -54,8 +56,8 @@ , StateVar >= 1.1 && < 2 , stm >= 2.2 && < 3 , tagged >= 0.7.3 && < 1- , template-haskell >= 2.4 && < 2.19- , th-abstraction >= 0.4 && < 0.5+ , template-haskell >= 2.4 && < 2.21+ , th-abstraction >= 0.4 && < 0.6 , transformers >= 0.2 && < 0.7 , transformers-compat >= 0.3 && < 1 , unordered-containers >= 0.2.4 && < 0.3@@ -75,7 +77,7 @@ , hspec >= 1.8 , invariant , QuickCheck >= 2.11 && < 3- , template-haskell >= 2.4 && < 2.19+ , template-haskell build-tool-depends: hspec-discover:hspec-discover ghc-options: -Wall if impl(ghc >= 8.6)
src/Data/Functor/Invariant/TH.hs view
@@ -40,7 +40,7 @@ import qualified Data.Map as Map ((!), fromList, keys, lookup, member, size) import Data.Maybe -import Language.Haskell.TH.Datatype+import Language.Haskell.TH.Datatype as Datatype import Language.Haskell.TH.Datatype.TyVarBndr import Language.Haskell.TH.Lib import Language.Haskell.TH.Ppr@@ -510,14 +510,17 @@ map (substNamesWithKindStar (List.union droppedKindVarNames kvNames')) $ take remainingLength varTysOrig - isDataFamily :: Bool- isDataFamily = case variant of- Datatype -> False- Newtype -> False- DataInstance -> True- NewtypeInstance -> True+ isDataFamily <-+ case variant of+ Datatype -> return False+ Newtype -> return False+ DataInstance -> return True+ NewtypeInstance -> return True+#if MIN_VERSION_th_abstraction(0,5,0)+ Datatype.TypeData -> typeDataError tyConName+#endif - remainingTysOrigSubst' :: [Type]+ let remainingTysOrigSubst' :: [Type] -- See Note [Kind signatures in derived instances] for an explanation -- of the isDataFamily check. remainingTysOrigSubst' =@@ -699,6 +702,17 @@ etaReductionError instanceType = fail $ "Cannot eta-reduce to an instance of form \n\tinstance (...) => " ++ pprint instanceType++#if MIN_VERSION_th_abstraction(0,5,0)+-- | We cannot implement class methods at the term level for @type data@+-- declarations, which only exist at the type level.+typeDataError :: Name -> Q a+typeDataError dataName = fail+ . showString "Cannot derive instance for ‘"+ . showString (nameBase dataName)+ . showString "‘, which is a ‘type data‘ declaration"+ $ ""+#endif ------------------------------------------------------------------------------- -- Generic traversal for functor-like deriving