deriving-compat 0.3.4 → 0.3.5
raw patch · 5 files changed
+70/−5 lines, 5 filesdep +taggeddep ~deriving-compatPVP ok
version bump matches the API change (PVP)
Dependencies added: tagged
Dependency ranges changed: deriving-compat
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- deriving-compat.cabal +5/−3
- src/Data/Ord/Deriving/Internal.hs +1/−1
- tests/GH6Spec.hs +44/−0
- tests/OrdSpec.hs +16/−1
CHANGELOG.md view
@@ -1,3 +1,7 @@+### 0.3.5 [2016.12.12]+* Fix bug in which derived `Ord` instances for datatypes with many constructors+ would fail to typecheck+ ### 0.3.4 [2016.10.20] * Fix bug in which infix record selectors weren't shown with parentheses in derived `Show` instances * Fix bug in which record selectors weren't parsed correctly in derived `Read` instances
deriving-compat.cabal view
@@ -1,5 +1,5 @@ name: deriving-compat-version: 0.3.4+version: 0.3.5 synopsis: Backports of GHC deriving extensions description: Provides Template Haskell functions that mimic deriving extensions that were introduced or modified in recent versions@@ -64,7 +64,7 @@ , GHC == 7.6.3 , GHC == 7.8.4 , GHC == 7.10.3- , GHC == 8.0.1+ , GHC == 8.0.2 cabal-version: >=1.10 source-repository head@@ -146,14 +146,16 @@ OrdSpec ReadSpec ShowSpec+ GH6Spec Types.EqOrd Types.ReadShow build-depends: base-compat >= 0.8.1 && < 1 , base-orphans >= 0.5 && < 1- , deriving-compat == 0.3.4+ , deriving-compat == 0.3.5 , hspec >= 1.8 , QuickCheck >= 2 && < 3+ , tagged >= 0.7 && < 1 , template-haskell >= 2.5 && < 2.12 if flag(base-4-9)
src/Data/Ord/Deriving/Internal.hs view
@@ -357,7 +357,7 @@ [] tagLit :: Q Exp- tagLit = litE . integerL $ fromIntegral tag+ tagLit = litE . intPrimL $ fromIntegral tag match (conP conName $ map varP as) (normalB innerRhs)
+ tests/GH6Spec.hs view
@@ -0,0 +1,44 @@+{-# LANGUAGE TemplateHaskell #-}++{-|+Module: GH6Spec+Copyright: (C) 2015-2016 Ryan Scott+License: BSD-style (see the file LICENSE)+Maintainer: Ryan Scott+Portability: Template Haskell++A regression test for+https://github.com/haskell-compat/deriving-compat/issues/6.+-}+module GH6Spec (main, spec) where++import Data.Deriving (deriveEq1, deriveOrd1)+import Data.Proxy (Proxy(..))++import OrdSpec (ordSpec)++import Prelude ()+import Prelude.Compat++import Test.Hspec (Spec, describe, hspec, parallel)+import Test.QuickCheck (Arbitrary(..), oneof)++data Foo a+ = Foo1 a+ | Foo2 a+ | Foo3 a+ | Foo4 a+ | Foo5 a+ deriving (Eq, Ord, Show)++deriveEq1 ''Foo+deriveOrd1 ''Foo++instance Arbitrary a => Arbitrary (Foo a) where+ arbitrary = oneof $ map (<$> arbitrary) [Foo1, Foo2, Foo3, Foo4, Foo5]++main :: IO ()+main = hspec spec++spec :: Spec+spec = parallel $ describe "GH6" $ ordSpec (Proxy :: Proxy (Foo Int))
tests/OrdSpec.hs view
@@ -1,3 +1,5 @@+{-# LANGUAGE ScopedTypeVariables #-}+ {-| Module: OrdSpec Copyright: (C) 2015-2016 Ryan Scott@@ -9,18 +11,31 @@ -} module OrdSpec where +import Data.Functor.Classes+ import Prelude () import Prelude.Compat import Test.Hspec+import Test.Hspec.QuickCheck (prop)+import Test.QuickCheck (Arbitrary) import Types.EqOrd () ------------------------------------------------------------------------------- +prop_Ord :: (Ord a, Ord (f a), Ord1 f) => f a -> f a -> Bool+prop_Ord x y = compare x y == compare1 x y++ordSpec :: forall proxy f a. (Arbitrary (f a), Show (f a),+ Ord a, Ord (f a), Ord1 f)+ => proxy (f a) -> Spec+ordSpec _ = prop "has a valid Ord1 instance" (prop_Ord :: f a -> f a -> Bool)++-------------------------------------------------------------------------------+ main :: IO () main = hspec spec spec :: Spec spec = pure ()-