dlist 0.8.0.3 → 0.8.0.4
raw patch · 4 files changed
+44/−23 lines, 4 filesdep −quickcheck-instancesdep ~QuickCheckPVP ok
version bump matches the API change (PVP)
Dependencies removed: quickcheck-instances
Dependency ranges changed: QuickCheck
API changes (from Hackage documentation)
Files
- ChangeLog.md +10/−0
- Data/DList.hs +7/−3
- dlist.cabal +5/−10
- tests/Main.hs +22/−10
ChangeLog.md view
@@ -2,6 +2,16 @@ Change Log ========== +Version 0.8.0.4 (2018-01-19) *Kokborok Day*+-------------------------------------------++#### Package changes++* Change QuickCheck upper bound from 2.11 to 2.12+* Make `Data.DList` trustworthy+ ([Bertram Felgenhauer](https://github.com/int-e))+* Remove quickcheck-instances dependency for tests+ Version 0.8.0.3 (2017-07-04) *Independence Day in the United States* --------------------------------------------------------------------
Data/DList.hs view
@@ -4,7 +4,11 @@ {-# LANGUAGE TypeFamilies #-} -- For the IsList and IsString instances #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708-{-# LANGUAGE PatternSynonyms, ViewPatterns #-}+{-# LANGUAGE PatternSynonyms #-}+-- Mark this module as trustworthy even though we import 'IsList' from GHC.Exts,+-- which is marked unsafe. 'IsList' is safe.+{-# LANGUAGE Trustworthy #-}+{-# LANGUAGE ViewPatterns #-} #endif -----------------------------------------------------------------------------@@ -83,8 +87,8 @@ #if __GLASGOW_HASKELL__ >= 708 import GHC.Exts (IsList)--- This is for the IsList methods, which conflict with fromList, toList:-import qualified GHC.Exts+-- Make IsList type and methods visible for instance.+import qualified GHC.Exts (IsList(Item, fromList, toList)) #endif #endif
dlist.cabal view
@@ -1,5 +1,5 @@ name: dlist-version: 0.8.0.3+version: 0.8.0.4 synopsis: Difference lists description: Difference lists are a list-like type supporting O(1) append. This is@@ -45,12 +45,7 @@ build-depends: dlist, base, Cabal,- QuickCheck < 2.11- -- Semigroup and NonEmpty were introduced in base-4.9 (ghc-8).- -- QuickCheck-2.9 included support. QuickCheck-2.10 dropped support.- -- quickcheck-instances-0.3.15 has the Arbitrary NonEmpty instance.- if impl(ghc > 8)- build-depends: QuickCheck >= 2.9,- quickcheck-instances >= 0.3.15 && < 0.4- else- build-depends: QuickCheck >= 2.7+ -- QuickCheck-2.10 is the first version supporting+ -- base-4.9 (ghc-8) without the Arbitrary NonEmpty+ -- instance, which we include ourselves.+ QuickCheck >= 2.10 && < 2.12
tests/Main.hs view
@@ -1,4 +1,5 @@-{-# OPTIONS_GHC -Wall #-}+{-# OPTIONS_GHC -Wall -fno-warn-orphans #-}+ {-# LANGUAGE CPP #-} #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE OverloadedLists #-} -- For the IsList test@@ -15,9 +16,10 @@ -------------------------------------------------------------------------------- import Prelude hiding (concat, foldr, head, map, replicate, tail)+ import qualified Data.List as List-import Text.Show.Functions () import Test.QuickCheck+import Text.Show.Functions () import Data.DList @@ -25,17 +27,12 @@ #if MIN_VERSION_base(4,9,0) -- base-4.9 introduced Semigroup and NonEmpty.+import Control.Applicative (liftA2) -- Arbitrary1 NonEmpty instance+import Data.Maybe (mapMaybe) -- Arbitrary1 NonEmpty instance+import Data.List.NonEmpty (NonEmpty(..), nonEmpty) import Data.Semigroup (Semigroup(..))-import Data.List.NonEmpty (NonEmpty(..))---- QuickCheck-2.10 dropped the Arbitrary NonEmpty instance, so we import it from--- quickcheck-instances.-#if MIN_VERSION_QuickCheck(2,10,0)-import Test.QuickCheck.Instances () #endif -#endif- -------------------------------------------------------------------------------- eqWith :: Eq b => (a -> b) -> (a -> b) -> a -> Bool@@ -121,6 +118,21 @@ #if MIN_VERSION_base(4,9,0) prop_Semigroup_append :: [Int] -> [Int] -> Bool prop_Semigroup_append xs ys = xs <> ys == toList (fromList xs <> fromList ys)++-- We include the instances for NonEmpty because QuickCheck (>= 2.10) does not.+-- We could alternatively depend on quickcheck-instances (>= 0.3.15), but+-- quickcheck-instances has sometimes lagged behind newer GHC/base versions. By+-- including the instances here, we do not need to track the+-- quickcheck-instances version, thus simplifying dlist.cabal and reducing the+-- maintenance effort.++instance Arbitrary1 NonEmpty where+ liftArbitrary arb = liftA2 (:|) arb (liftArbitrary arb)+ liftShrink shr (x :| xs) = mapMaybe nonEmpty . liftShrink shr $ x : xs++instance Arbitrary a => Arbitrary (NonEmpty a) where+ arbitrary = arbitrary1+ shrink = shrink1 prop_Semigroup_sconcat :: NonEmpty [Int] -> Bool prop_Semigroup_sconcat xs = sconcat xs == toList (sconcat (fmap fromList xs))