data-fix 0.3.3 → 0.3.4
raw patch · 3 files changed
+45/−8 lines, 3 filesdep ~basedep ~hashablePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, hashable
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- data-fix.cabal +7/−7
- src/Data/Fix.hs +33/−1
CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.3.4++- Use quantified constraints superclasses for `Eq`, `Ord`, `NFData` and+ `Hashable Fix` instances, when available.+ ## 0.3.3 - Drop support for GHCs prior 8.6.5
data-fix.cabal view
@@ -1,7 +1,7 @@+cabal-version: 2.2 Name: data-fix-Version: 0.3.3-Cabal-Version: >= 1.10-License: BSD3+Version: 0.3.4+License: BSD-3-Clause License-file: LICENSE Author: Anton Kholomiov, Edward Kmett, Oleg Grenrus Maintainer: <anton.kholomiov@gmail.com>@@ -26,7 +26,7 @@ || ==9.0.2 || ==9.2.8 || ==9.4.8- || ==9.6.5+ || ==9.6.6 || ==9.8.2 || ==9.10.1 @@ -49,6 +49,6 @@ -Wredundant-constraints -Widentities -Wmissing-export-lists build-depends:- base >=4.12.0.0 && <4.21- , deepseq >=1.4.4.0 && <1.6- , hashable >=1.4.4.0 && <1.5+ , base >=4.12.0.0 && <4.21+ , deepseq >=1.4.4.0 && <1.6+ , hashable >=1.4.4.0 && <1.6
src/Data/Fix.hs view
@@ -9,6 +9,7 @@ {-# LANGUAGE UndecidableInstances #-} #define HAS_POLY_TYPEABLE MIN_VERSION_base(4,7,0)+#define HAS_QUANTIFIED_FUNCTOR_CLASSES MIN_VERSION_base(4,18,0) #if HAS_POLY_TYPEABLE {-# LANGUAGE StandaloneDeriving #-}@@ -97,7 +98,7 @@ import Control.Monad (liftM) import Data.Function (on)-import Data.Functor.Classes (Eq1, Ord1, Read1, Show1, compare1, eq1, readsPrec1, showsPrec1)+import Data.Functor.Classes (Eq1, Ord1, Read1, Show1, readsPrec1, showsPrec1) import Data.Hashable (Hashable (..)) import Data.Hashable.Lifted (Hashable1, hashWithSalt1) import Data.Typeable (Typeable)@@ -114,6 +115,10 @@ import Data.Data #endif +#if !HAS_QUANTIFIED_FUNCTOR_CLASSES+import Data.Functor.Classes (compare1, eq1)+#endif+ -- $setup -- >>> :set -XDeriveFunctor -- >>> import Prelude@@ -191,10 +196,24 @@ ------------------------------------------------------------------------------- instance Eq1 f => Eq (Fix f) where+#if HAS_QUANTIFIED_FUNCTOR_CLASSES+ Fix a == Fix b = a == b+#else Fix a == Fix b = eq1 a b+#endif instance Ord1 f => Ord (Fix f) where+#if HAS_QUANTIFIED_FUNCTOR_CLASSES+ compare (Fix a) (Fix b) = compare a b+ min (Fix a) (Fix b) = Fix (min a b)+ max (Fix a) (Fix b) = Fix (max a b)+ Fix a >= Fix b = a >= b+ Fix a > Fix b = a > b+ Fix a < Fix b = a < b+ Fix a <= Fix b = a <= b+#else compare (Fix a) (Fix b) = compare1 a b+#endif instance Show1 f => Show (Fix f) where showsPrec d (Fix a) =@@ -214,11 +233,24 @@ ------------------------------------------------------------------------------- instance Hashable1 f => Hashable (Fix f) where+#if MIN_VERSION_hashable(1,5,0)+ hash (Fix x) = hash x+ hashWithSalt salt (Fix x) = hashWithSalt salt x+#else hashWithSalt salt = hashWithSalt1 salt . unFix+#endif +-------------------------------------------------------------------------------+-- deepseq+-------------------------------------------------------------------------------+ #if MIN_VERSION_deepseq(1,4,3) instance NFData1 f => NFData (Fix f) where+#if MIN_VERSION_deepseq(1,5,0)+ rnf (Fix a) = rnf a +#else rnf = rnf1 . unFix+#endif #endif -------------------------------------------------------------------------------