Skip to content

Commit

Permalink
Merge pull request #95 from haskellari/noble
Browse files Browse the repository at this point in the history
Support GHC-8.6.5...9.10.1
  • Loading branch information
phadej authored May 16, 2024
2 parents 4545acb + 6162c60 commit 378767c
Show file tree
Hide file tree
Showing 28 changed files with 113 additions and 356 deletions.
137 changes: 44 additions & 93 deletions .github/workflows/haskell-ci.yml

Large diffs are not rendered by default.

43 changes: 19 additions & 24 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
branches: master
head-hackage: False

-- constraint-set QuickCheck-2.13
-- constraints: QuickCheck==2.13.*

constraint-set lower-bounds-7.4.2
ghc: ==7.4.2
constraint-set lower-bounds-8.6.5
ghc: ==8.6.5
constraints:
QuickCheck ==2.14.1,
array ==0.4.0.0,
base ==4.5.1.0,
base-compat ==0.10.5,
bytestring ==0.9.2.1,
case-insensitive ==1.2.0.4,
containers ==0.4.2.1,
hashable ==1.2.7.0,
nats ==1.1.2,
QuickCheck ==2.14.2,
array ==0.5.3.0,
base ==4.12.0.0,
bytestring ==0.10.8.2,
case-insensitive ==1.2.0.11,
containers ==0.6.0.1,
hashable ==1.4.4.0,
old-time ==1.1.0.0,
scientific ==0.3.6.2,
semigroups ==0.18.5,
tagged ==0.8.6,
OneTuple ==0.4.2,
scientific ==0.3.8.0,
primitive ==0.9.0.0,
strict ==0.5,
tagged ==0.8.8,
text ==1.2.3.0,
these ==1.1.1.1,
time ==1.2.0.1,
transformers ==0.3.0.0,
transformers-compat ==0.6.5,
unordered-containers ==0.2.2.0,
uuid-types ==1.0.4,
vector ==0.12.3.1
these ==1.2.1,
transformers ==0.5.6.2,
unordered-containers ==0.2.20,
uuid-types ==1.0.6,
vector ==0.13.1.0

constraint-set text-1.2
ghc: <9.3
Expand Down
3 changes: 0 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
packages: .

-- allow-newer: bytestring
-- constraints: bytestring ^>=0.11
114 changes: 43 additions & 71 deletions quickcheck-instances.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: quickcheck-instances
version: 0.3.30
x-revision: 1
version: 0.3.31
synopsis: Common quickcheck instances
description:
QuickCheck instances.
Expand All @@ -14,7 +14,7 @@ description:
impose these instances on down-stream consumers of
your code.

license: BSD3
license: BSD-3-Clause
license-file: LICENSE
author:
Antoine Latter <[email protected]>, Oleg Grenrus <[email protected]>
Expand All @@ -26,35 +26,29 @@ copyright: Copyright 2012-2016 Antoine Latter, 2017-2019 Oleg Grenrus
category: Testing
build-type: Simple
extra-source-files: CHANGES
cabal-version: >=1.10
tested-with:
GHC ==7.4.2
|| ==7.6.3
|| ==7.8.4
|| ==7.10.3
|| ==8.0.2
|| ==8.2.2
|| ==8.4.4
|| ==8.6.5
GHC ==8.6.5
|| ==8.8.4
|| ==8.10.7
|| ==9.0.2
|| ==9.2.8
|| ==9.4.7
|| ==9.6.3
|| ==9.8.1
|| ==9.4.8
|| ==9.6.5
|| ==9.8.2
|| ==9.10.1

source-repository head
type: git
location: https://github.com/haskellari/qc-instances.git

flag bytestring-builder
description: Use bytestring-builder (with old bytestring)
default: False
manual: False

library
default-language: Haskell2010
default-language: Haskell2010
default-extensions:
BangPatterns
FlexibleContexts
FlexibleInstances
TypeOperators

exposed-modules:
Test.QuickCheck.Instances
Test.QuickCheck.Instances.Array
Expand All @@ -73,6 +67,7 @@ library
Test.QuickCheck.Instances.Strict
Test.QuickCheck.Instances.Tagged
Test.QuickCheck.Instances.Text
Test.QuickCheck.Instances.Text.Short
Test.QuickCheck.Instances.These
Test.QuickCheck.Instances.Time
Test.QuickCheck.Instances.Transformer
Expand All @@ -81,71 +76,48 @@ library
Test.QuickCheck.Instances.Vector
Test.QuickCheck.Instances.Void

other-modules: Test.QuickCheck.Instances.CustomPrelude
hs-source-dirs: src
other-modules: Test.QuickCheck.Instances.CustomPrelude
hs-source-dirs: src
build-depends:
base >=4.5 && <4.20
, QuickCheck >=2.14.1 && <2.14.4
, splitmix >=0.0.2 && <0.2
, base >=4.12.0.0 && <4.21
, QuickCheck >=2.14.2 && <2.15.0
, splitmix >=0.1.0.5 && <0.2

build-depends:
array >=0.4.0.0 && <0.6
, bytestring >=0.9.2.1 && <0.13
, case-insensitive >=1.2.0.4 && <1.3
, containers >=0.4.2.1 && <0.7
, array >=0.5.3.0 && <0.6
, bytestring >=0.10.8.2 && <0.13
, case-insensitive >=1.2.0.11 && <1.3
, containers >=0.6.0.1 && <0.8
, data-fix >=0.3 && <0.4
, hashable >=1.2.7.0 && <1.5
, integer-logarithms >=1.0.3 && <1.1
, hashable >=1.4.4.0 && <1.5
, integer-logarithms >=1.0.3.1 && <1.1
, old-time >=1.1.0.0 && <1.2
, OneTuple >=0.3 && <0.5
, primitive >=0.6.4.0 && <0.10
, scientific >=0.3.6.2 && <0.4
, strict >=0.4 && <0.6
, tagged >=0.8.6 && <0.9
, text >=1.2.3.0 && <1.3 || >=2.0 && <2.2
, these >=1.1.1.1 && <1.3
, OneTuple >=0.4.2 && <0.5
, primitive >=0.9.0.0 && <0.10
, scientific >=0.3.8.0 && <0.4
, strict >=0.5 && <0.6
, tagged >=0.8.8 && <0.9
, text >=1.2.3.0 && <1.3 || >=2.0 && <2.2
, text-short >=0.1.4 && <0.2
, these >=1.2.1 && <1.3
, time-compat >=1.9.4 && <1.10
, transformers >=0.3.0.0 && <0.7
, transformers-compat >=0.6.5 && <0.8
, unordered-containers >=0.2.2.0 && <0.3
, uuid-types >=1.0.4 && <1.1
, vector >=0.12.3.1 && <0.14
, transformers >=0.5.6.2 && <0.7
, unordered-containers >=0.2.20 && <0.3
, uuid-types >=1.0.6 && <1.1
, vector >=0.13.1.0 && <0.14

-- version is irrelevant.
build-depends: time

if impl(ghc >=8.0 && <9.4)
if impl(ghc <9.4)
build-depends: data-array-byte >=0.1.0.1 && <0.2

if !impl(ghc >=8.0)
build-depends: semigroups >=0.18.5 && <0.21

if !impl(ghc >=7.10)
build-depends:
nats >=1.1.2 && <1.2
, void >=0.7.2 && <0.8

if flag(bytestring-builder)
build-depends:
bytestring <0.10.4.0
, bytestring-builder >=0.10.4 && <0.11

else
build-depends: bytestring >=0.10.4.0

if impl(ghc >=7.8)
exposed-modules: Test.QuickCheck.Instances.Text.Short
build-depends: text-short >=0.1.3 && <0.2

ghc-options: -Wall
ghc-options: -Wall

test-suite self-test
default-language: Haskell2010
type: exitcode-stdio-1.0
main-is: Tests.hs
hs-source-dirs: test
build-depends:
base
, base
, containers
, primitive
, QuickCheck
Expand All @@ -162,7 +134,7 @@ benchmark bytestring-gen
main-is: ByteString.hs
hs-source-dirs: bench
build-depends:
base
, base
, bytestring
, QuickCheck
, quickcheck-instances
6 changes: 1 addition & 5 deletions src/Test/QuickCheck/Instances.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE CPP #-}
{-|
Instances are provided for the types in the packages:
Expand Down Expand Up @@ -59,14 +58,11 @@ import Test.QuickCheck.Instances.Solo ()
import Test.QuickCheck.Instances.Strict ()
import Test.QuickCheck.Instances.Tagged ()
import Test.QuickCheck.Instances.Text ()
import Test.QuickCheck.Instances.Text.Short ()
import Test.QuickCheck.Instances.These ()
import Test.QuickCheck.Instances.Time ()
import Test.QuickCheck.Instances.Transformer ()
import Test.QuickCheck.Instances.UnorderedContainers ()
import Test.QuickCheck.Instances.UUID ()
import Test.QuickCheck.Instances.Vector ()
import Test.QuickCheck.Instances.Void ()

#ifdef MIN_VERSION_text_short
import Test.QuickCheck.Instances.Text.Short ()
#endif
2 changes: 0 additions & 2 deletions src/Test/QuickCheck/Instances/Array.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Test.QuickCheck.Instances.Array () where

Expand Down
32 changes: 0 additions & 32 deletions src/Test/QuickCheck/Instances/Array/Byte.hs
Original file line number Diff line number Diff line change
@@ -1,36 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Test.QuickCheck.Instances.Array.Byte () where

#if !MIN_VERSION_primitive(0,8,0) && MIN_VERSION_base(4,9,0)

import Prelude ()
import Test.QuickCheck.Instances.CustomPrelude
import Test.QuickCheck.Instances.Primitive ()

import Test.QuickCheck

import Data.Array.Byte (ByteArray (..))
import qualified Data.Primitive as P

-- | @since 0.3.28
instance Arbitrary ByteArray where
arbitrary = fromP <$> arbitrary
shrink ba = fromP <$> shrink (toP ba)

-- | @since 0.3.28
instance CoArbitrary ByteArray where
coarbitrary ba = coarbitrary (toP ba)

-- | @since 0.3.28
instance Function ByteArray where
function = functionMap toP fromP

toP :: ByteArray -> P.ByteArray
toP (ByteArray ba) = P.ByteArray ba

fromP :: P.ByteArray -> ByteArray
fromP (P.ByteArray ba) = ByteArray ba

#endif
2 changes: 0 additions & 2 deletions src/Test/QuickCheck/Instances/ByteString.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Test.QuickCheck.Instances.ByteString () where

Expand Down
2 changes: 0 additions & 2 deletions src/Test/QuickCheck/Instances/CaseInsensitive.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Test.QuickCheck.Instances.CaseInsensitive () where

Expand Down
57 changes: 0 additions & 57 deletions src/Test/QuickCheck/Instances/Containers.hs
Original file line number Diff line number Diff line change
@@ -1,58 +1 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Test.QuickCheck.Instances.Containers () where

#if !MIN_VERSION_QuickCheck(2,14,2)
import Prelude ()
import Test.QuickCheck.Instances.CustomPrelude

import Test.QuickCheck
(Arbitrary (..), Arbitrary1 (..), CoArbitrary (..), Function (..), Gen,
arbitrary1, chooseInt, functionMap, liftShrink2, shrink1, shuffle,
sized)

import qualified Data.Tree as Tree

-------------------------------------------------------------------------------
-- containers
-------------------------------------------------------------------------------

instance Arbitrary1 Tree.Tree where
liftArbitrary arb = sized $ \n -> do
k <- chooseInt (0, n)
go k
where
go n = do -- n is the size of the trees.
value <- arb
pars <- arbPartition (n - 1) -- can go negative!
forest <- traverse go pars
return $ Tree.Node value forest

arbPartition :: Int -> Gen [Int]
arbPartition k = case compare k 1 of
LT -> pure []
EQ -> pure [1]
GT -> do
first <- chooseInt (1, k)
rest <- arbPartition $ k - first
shuffle (first : rest)

liftShrink shr = go
where
go (Tree.Node val forest) = forest ++
[ Tree.Node e fs
| (e, fs) <- liftShrink2 shr (liftShrink go) (val, forest)
]

instance Arbitrary a => Arbitrary (Tree.Tree a) where
arbitrary = arbitrary1
shrink = shrink1

instance CoArbitrary a => CoArbitrary (Tree.Tree a) where
coarbitrary (Tree.Node val forest) =
coarbitrary val . coarbitrary forest

instance Function a => Function (Tree.Tree a) where
function = functionMap (\(Tree.Node x xs) -> (x,xs)) (uncurry Tree.Node)
#endif
Loading

0 comments on commit 378767c

Please sign in to comment.