finitary 2.2.0.0 → 2.2.0.1
raw patch · 3 files changed
+53/−52 lines, 3 filesdep ~ghc-typelits-knownnatdep ~ghc-typelits-natnormalisedep ~hedgehogPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: ghc-typelits-knownnat, ghc-typelits-natnormalise, hedgehog, hspec-hedgehog, template-haskell
API changes (from Hackage documentation)
+ Data.Finitary: ($dmfromFinite) :: (Finitary a, Generic a, GFinitary (Rep a), Cardinality a ~ GCardinality (Rep a)) => Finite (Cardinality a) -> a
+ Data.Finitary: ($dmtoFinite) :: (Finitary a, Generic a, GFinitary (Rep a), Cardinality a ~ GCardinality (Rep a)) => a -> Finite (Cardinality a)
- Data.Finitary: class (Eq a, KnownNat (Cardinality a)) => Finitary (a :: Type) where {
+ Data.Finitary: class (Eq a, KnownNat Cardinality a) => Finitary a where {
- Data.Finitary: end :: (Finitary a, 1 <= Cardinality a) => a
+ Data.Finitary: end :: Finitary a => a
- Data.Finitary: fromFinite :: (Finitary a, Generic a, GFinitary (Rep a), Cardinality a ~ GCardinality (Rep a)) => Finite (Cardinality a) -> a
+ Data.Finitary: fromFinite :: Finitary a => Finite (Cardinality a) -> a
- Data.Finitary: inhabitants :: forall (a :: Type). Finitary a => [a]
+ Data.Finitary: inhabitants :: Finitary a => [a]
- Data.Finitary: inhabitantsFrom :: forall (a :: Type). Finitary a => a -> NonEmpty a
+ Data.Finitary: inhabitantsFrom :: Finitary a => a -> NonEmpty a
- Data.Finitary: inhabitantsFromTo :: forall (a :: Type). Finitary a => a -> a -> [a]
+ Data.Finitary: inhabitantsFromTo :: Finitary a => a -> a -> [a]
- Data.Finitary: inhabitantsTo :: forall (a :: Type). Finitary a => a -> NonEmpty a
+ Data.Finitary: inhabitantsTo :: Finitary a => a -> NonEmpty a
- Data.Finitary: start :: (Finitary a, 1 <= Cardinality a) => a
+ Data.Finitary: start :: Finitary a => a
- Data.Finitary: toFinite :: (Finitary a, Generic a, GFinitary (Rep a), Cardinality a ~ GCardinality (Rep a)) => a -> Finite (Cardinality a)
+ Data.Finitary: toFinite :: Finitary a => a -> Finite (Cardinality a)
- Data.Finitary: type Cardinality a = GCardinality (Rep a);
+ Data.Finitary: type Cardinality a = GCardinality Rep a;
Files
- CHANGELOG.md +9/−0
- finitary.cabal +9/−9
- test/Main.hs +35/−43
CHANGELOG.md view
@@ -1,5 +1,14 @@ # Revision history for finitary +## 2.2.0.1 -- 2026-04-18 + +* Relax upper bounds: + + - `ghc-typelits-knownnat`: `< 0.8 ==> < 0.9` + - `ghc-typelits-natnormalise`: `< 0.8 ==> < 0.10` + +* Update the testsuite to account for changes in `hspec-hedgehog`. + ## 2.2.0.0 -- 2024-08-07 * Fix behaviour of `previous` and `next`, which incorrectly handled endpoints.
finitary.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: finitary -version: 2.2.0.0 +version: 2.2.0.1 synopsis: A better, more type-safe Enum. description: Provides a type class witnessing that a type has @@ -9,8 +9,8 @@ Generics, together with a range of instances for existing types. -homepage: https://notabug.org/sheaf/finitary -bug-reports: https://notabug.org/sheaf/finitary/issues +homepage: https://codeberg.org/sheaf/finitary +bug-reports: https://codeberg.org/sheaf/finitary/issues license: GPL-3.0-or-later license-file: LICENSE.md author: Koz Ross @@ -35,7 +35,7 @@ source-repository head type: git - location: git://notabug.org/sheaf/finitary.git + location: https://codeberg.org/sheaf/finitary.git library exposed-modules: Data.Finitary @@ -46,11 +46,11 @@ , finite-typelits >= 0.1.4.2 && < 0.3 , ghc-typelits-knownnat - ^>= 0.7.2 + >= 0.7.2 && < 0.9 , ghc-typelits-natnormalise - ^>= 0.7.2 + >= 0.7.2 && < 0.10 , template-haskell - >= 2.14.0.0 && < 3.0.0.0 + >= 2.14.0.0 && < 3 if flag(bitvec) cpp-options: @@ -90,11 +90,11 @@ , ghc-typelits-knownnat , ghc-typelits-natnormalise , hedgehog - >= 1.0.2 && < 1.6 + >= 1.0.2 && < 1.8 , hspec >= 2.7.1 && < 3.0 , hspec-hedgehog - >= 0.0.1.2 && < 0.3 + >= 0.0.1.2 && < 0.4 , primitive , template-haskell , typelits-witnesses
test/Main.hs view
@@ -25,6 +25,7 @@ module Main where +-- base import Data.Bit (Bit) import Data.Finitary (Finitary (..)) import Data.Finite (Finite) @@ -34,20 +35,30 @@ import Data.Ord (Down (..)) import Data.Proxy (Proxy (..)) import Data.Semigroup (All, Any, Dual, First, Last, Max, Min, Product, Sum) -import qualified Data.Vector.Sized as V -import qualified Data.Vector.Storable.Sized as VS -import Data.Vector.Unboxed.Sized (Unbox) -import qualified Data.Vector.Unboxed.Sized as VU import Data.Word (Word16, Word32, Word64, Word8) import Foreign.Storable (Storable) import GHC.Generics (Generic) import GHC.TypeNats (type (<=)) + +-- vector-sized +import qualified Data.Vector.Sized as V +import qualified Data.Vector.Storable.Sized as VS +import Data.Vector.Unboxed.Sized (Unbox) +import qualified Data.Vector.Unboxed.Sized as VU + +-- hedgehog import Hedgehog ((===), Gen, PropertyT, forAll) import qualified Hedgehog.Gen as Gen import Hedgehog.Range (constantBounded) + +-- hspec import Test.Hspec (SpecWith, describe, hspec, it, parallel, shouldBe) -import Test.Hspec.Hedgehog (hedgehog, modifyMaxSize) +-- hspec-hedgehod +import Test.Hspec.Hedgehog (hedgehog) + +-------------------------------------------------------------------------------- + main :: IO () main = hspec . parallel $ do describe "Previous and next values for bounds" $ do @@ -94,85 +105,66 @@ describe "Bijectivity and order preservation" $ do checkBijection "Char" Gen.unicode checkBijection "Word8" (Gen.enumBounded @_ @Word8) - modifyMaxSize (const 10000) - . checkBijection "Word16" + checkBijection "Word16" $ Gen.enumBounded @_ @Word16 - modifyMaxSize (const 10000) - . checkBijection "Word32" + checkBijection "Word32" $ Gen.enumBounded @_ @Word32 - modifyMaxSize (const 10000) - . checkBijection "Word64" + checkBijection "Word64" $ Gen.word64 constantBounded checkBijection "Int8" (Gen.enumBounded @_ @Int8) - modifyMaxSize (const 10000) - . checkBijection "Int16" + checkBijection "Int16" $ Gen.enumBounded @_ @Int16 - modifyMaxSize (const 10000) - . checkBijection "Int32" + checkBijection "Int32" $ Gen.enumBounded @_ @Int32 - modifyMaxSize (const 10000) - . checkBijection "Int64" + checkBijection "Int64" $ Gen.int64 constantBounded - modifyMaxSize (const 10000) - . checkBijection "Int" + checkBijection "Int" $ Gen.int constantBounded - modifyMaxSize (const 10000) - . checkBijection "Word" + checkBijection "Word" $ Gen.word constantBounded describe "Down" $ do checkMonotonic "Bool" Gen.bool - modifyMaxSize (const 10000) - . checkMonotonic "Int" + checkMonotonic "Int" $ (Gen.enumBounded @_ @Int) - modifyMaxSize (const 10000) - . checkMonotonic "(Either Int32 Bool)" + checkMonotonic "(Either Int32 Bool)" $ Gen.choice [ Left <$> Gen.enumBounded @_ @Int32, Right <$> Gen.enumBounded @_ @Bool ] - modifyMaxSize (const 10000) - . checkMonotonic "(Int32, Bool)" + checkMonotonic "(Int32, Bool)" $ ( (,) <$> Gen.enumBounded @_ @Int32 <*> Gen.enumBounded @_ @Bool ) - modifyMaxSize (const 10000) - . checkMonotonic "of a user-defined type" + checkMonotonic "of a user-defined type" $ genFoo describe "Fixed-length vectors" $ do - modifyMaxSize (const 10000) - . checkStorable "Int8" + checkStorable "Int8" . genStorable $ Gen.enumBounded @_ @Int8 - modifyMaxSize (const 10000) - . checkUnboxed "Int8" + checkUnboxed "Int8" . genUnboxed $ Gen.enumBounded @_ @Int8 - modifyMaxSize (const 10000) - . checkRegular "Int8" + checkRegular "Int8" . genRegular $ Gen.enumBounded @_ @Int8 - modifyMaxSize (const 10000) - . checkUnboxed "(Int8, Int8)" + checkUnboxed "(Int8, Int8)" . genUnboxed $ ( (,) <$> Gen.enumBounded @_ @Int8 <*> Gen.enumBounded @_ @Int8 ) - modifyMaxSize (const 10000) - . checkRegular "(Int8, Int8)" + checkRegular "(Int8, Int8)" . genRegular $ ( (,) <$> Gen.enumBounded @_ @Int8 <*> Gen.enumBounded @_ @Int8 ) - modifyMaxSize (const 10000) - . checkRegular "Either Int8 Bool" + checkRegular "Either Int8 Bool" . genRegular . Gen.choice $ [ Left <$> Gen.enumBounded @_ @Int8, Right <$> Gen.bool ] - modifyMaxSize (const 10000) - . checkRegular "a user defined type" + checkRegular "a user defined type" . genRegular $ genFoo