packages feed

subcategories 0.1.1.0 → 0.2.0.0

raw patch · 13 files changed

+125/−21 lines, 13 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for subcategories +# 0.2.0.0+* Supports GHC >= 9.2.+* As base >= 4.16 removes Data.Semigroup.Option, this package+  drops instance for Option accordingly for GHC >= 9.2.+  It seems that PVP demands us to bump the major version.+ ## 0.1.1.0 Support GHC >= 9.0 
src/Control/Subcategory/Alternative.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE EmptyCase, ScopedTypeVariables, StandaloneDeriving #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wno-orphans #-} module Control.Subcategory.Alternative   (CAlternative(..), CChoice(..), CAlt(..)) where@@ -49,7 +50,10 @@ instance CChoice SA.SmallArray instance CChoice A.Array instance CChoice Seq.Seq+#if !MIN_VERSION_base(4,16,0) instance CChoice Sem.Option+#endif+ instance CChoice NonEmpty where   (<!>) = (Sem.<>)   {-# INLINE (<!>) #-}@@ -123,7 +127,9 @@ instance CAlternative [] instance CAlternative Maybe instance CAlternative Seq.Seq+#if !MIN_VERSION_base(4,16,0) instance CAlternative Sem.Option+#endif instance CAlternative ReadP instance CAlternative V.Vector instance CAlternative U.Vector where@@ -156,4 +162,4 @@  instance (Dom f a, CAlternative f) => Monoid (CAlt f a) where   mempty = coerce @(f a) cempty-  mappend = coerce @(f a -> f a -> f a) (<!>)+  mappend = (<>)
src/Control/Subcategory/Applicative.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE EmptyCase, StandaloneDeriving, TupleSections #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE UndecidableSuperClasses                      #-} {-# OPTIONS_GHC -Wno-orphans #-} module Control.Subcategory.Applicative@@ -24,7 +25,9 @@ import qualified Data.Map                        as Map import qualified Data.Primitive.Array            as A import qualified Data.Primitive.SmallArray       as SA+#if !MIN_VERSION_base(4,16,0) import qualified Data.Semigroup                  as Sem+#endif import qualified Data.Sequence                   as Seq import qualified Data.Set                        as Set import qualified Data.Tree                       as Tree@@ -64,7 +67,9 @@ instance CApplicative Identity instance CApplicative Tree.Tree instance CApplicative Seq.Seq+#if !MIN_VERSION_base(4,16,0) instance CApplicative Sem.Option+#endif instance CApplicative NonEmpty instance CApplicative ((->) a) instance CApplicative (Either a)@@ -164,5 +169,5 @@  instance (Dom f a, CPointed f, CApplicative f, Monoid a, Dom f (a, a))        => Monoid (CApp f a) where-  CApp a `mappend` CApp b = CApp $ uncurry mappend <$:> pair a b+  mappend = (<>)   mempty = CApp $ cpure mempty
src/Control/Subcategory/Bind.hs view
@@ -1,5 +1,5 @@-module Control.Subcategory.Bind-  (CBind(..), CMonad, creturn, (-<<)) where+{-# LANGUAGE CPP #-}+module Control.Subcategory.Bind (CBind(..), CMonad, creturn, (-<<)) where import Control.Subcategory.Functor import Control.Subcategory.Pointed @@ -17,7 +17,9 @@ import           Data.List.NonEmpty              (NonEmpty) import qualified Data.Map                        as Map import           Data.MonoTraversable+#if !MIN_VERSION_base(4,16,0) import qualified Data.Semigroup                  as Sem+#endif import qualified Data.Sequence                   as Seq import qualified Data.Set                        as Set import qualified Data.Tree                       as Tree@@ -94,10 +96,11 @@ instance CBind Seq.Seq where   (>>-) = (>>=)   {-# INLINE (>>-) #-}-+#if !MIN_VERSION_base(4,16,0) instance CBind Sem.Option where   (>>-) = (>>=)   {-# INLINE (>>-) #-}+#endif  instance CBind ((->) a) where   (>>-) = (>>=)
src/Control/Subcategory/Foldable.hs view
@@ -52,8 +52,7 @@ import qualified Data.Primitive.PrimArray             as PA import qualified Data.Primitive.SmallArray            as SA import           Data.Proxy                           (Proxy)-import           Data.Semigroup                       (Arg, Max (..), Min (..),-                                                       Option)+import           Data.Semigroup                       (Arg, Max (..), Min (..)) import qualified Data.Semigroup                       as Sem import qualified Data.Sequence                        as Seq import           Data.Sequences                       (IsSequence (indexEx))@@ -511,11 +510,14 @@   cindex = (!!) . getZipList   #-} -deriving via WrapFunctor Option-  instance CFoldable Option-instance CTraversable Option where+#if !MIN_VERSION_base(4,16,0)+deriving via WrapFunctor Sem.Option+  instance CFoldable Sem.Option+instance CTraversable Sem.Option where   ctraverse = traverse   {-# INLINE [1] ctraverse #-}+#endif+ deriving via WrapFunctor Min   instance CFoldable Min instance CTraversable Min where
src/Control/Subcategory/Functor.hs view
@@ -139,8 +139,11 @@ instance CFunctor GetOpt.OptDescr instance Constrained GetOpt.ArgOrder instance CFunctor GetOpt.ArgOrder+#if !MIN_VERSION_base(4,16,0) instance Constrained Sem.Option instance CFunctor Sem.Option+#endif+  instance Constrained Sem.Last instance CFunctor Sem.Last
src/Control/Subcategory/Pointed.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE DerivingVia, StandaloneDeriving, TypeOperators #-}+{-# LANGUAGE CPP #-} module Control.Subcategory.Pointed where import Control.Subcategory.Functor @@ -54,7 +55,10 @@ instance CPointed Mon.Last instance CPointed Sem.First instance CPointed Sem.Last+#if !MIN_VERSION_base(4,16,0) instance CPointed Sem.Option+#endif+ instance CPointed NonEmpty instance CPointed App.ZipList instance CPointed Identity
src/Control/Subcategory/Semialign.hs view
@@ -28,7 +28,9 @@ import qualified Data.Primitive.SmallArray            as SA import           Data.Proxy                           (Proxy) import           Data.Semialign+#if !MIN_VERSION_base(4,16,0) import           Data.Semigroup                       (Option (..))+#endif import           Data.Sequence                        (Seq) import qualified Data.Sequences                       as MT import           Data.These                           (These (..), fromThese,@@ -79,12 +81,14 @@ deriving via WrapFunctor [] instance CAlign [] deriving via WrapFunctor Maybe instance CSemialign Maybe deriving via WrapFunctor Maybe instance CAlign Maybe+#if !MIN_VERSION_base(4,16,0) #if MIN_VERSION_semialign(1,1,0) deriving via WrapFunctor Option instance CSemialign Option deriving via WrapFunctor Option instance CAlign Option #else deriving newtype instance CSemialign Option deriving newtype instance CAlign Option+#endif #endif  deriving via WrapFunctor ZipList instance CSemialign ZipList
src/Control/Subcategory/Zip.hs view
@@ -29,7 +29,9 @@ import qualified Data.Primitive.PrimArray             as PA import qualified Data.Primitive.SmallArray            as SA import           Data.Proxy+#if !MIN_VERSION_base(4,16,0) import           Data.Semigroup                       (Option (..))+#endif import qualified Data.Sequence                        as Seq import qualified Data.Sequences                       as MT import           Data.Tree@@ -63,7 +65,9 @@  deriving via WrapFunctor [] instance CZip [] deriving via WrapFunctor Maybe instance CZip Maybe+#if !MIN_VERSION_base(4,16,0) deriving newtype instance CZip Option+#endif deriving via WrapFunctor ZipList instance CZip ZipList deriving via WrapFunctor Identity instance CZip Identity deriving via WrapFunctor NE.NonEmpty instance CZip NE.NonEmpty@@ -211,7 +215,9 @@   {-# INLINE [1] crepeat #-} deriving via WrapFunctor [] instance CRepeat [] deriving via WrapFunctor Maybe instance CRepeat Maybe+#if !MIN_VERSION_base(4,16,0) deriving newtype instance CRepeat Option+#endif deriving via WrapFunctor ZipList instance CRepeat ZipList deriving via WrapFunctor Identity instance CRepeat Identity deriving via WrapFunctor NE.NonEmpty instance CRepeat NE.NonEmpty@@ -299,7 +305,9 @@  deriving via WrapFunctor Maybe instance CUnzip Maybe #if MIN_VERSION_semialign(1,1,0)+#if !MIN_VERSION_base(4,16,0) deriving via WrapFunctor Option instance CUnzip Option+#endif #endif deriving via [] instance CUnzip ZipList deriving via WrapFunctor Identity instance CUnzip Identity
subcategories.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack ----- hash: fe6bc4de5931551cb2eb584dcbd9ed3c9ed1692f00c9fa0323cc2b6ddb28fb61+-- hash: a052deb998ce38ed1f948faaab71f0264136b956dcf9e11bd1387cfde0c399d4  name:           subcategories-version:        0.1.1.0+version:        0.2.0.0 synopsis:       Subcategories induced by class constraints description:    Please see the README on GitHub at <https://github.com/konn/subcategories#readme> category:       Data@@ -18,7 +18,8 @@ copyright:      2018 (c) Hiromi ISHII license:        BSD3 license-file:   LICENSE-tested-with:    GHC == 8.6.5, GHC == 8.8.3, GHC == 8.10.3, GHC == 9.0.1+tested-with:+    GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.1 build-type:     Simple extra-source-files:     README.md@@ -46,7 +47,24 @@       Control.Subcategory.Wrapper.Internal   hs-source-dirs:       src-  default-extensions: ConstraintKinds DataKinds DefaultSignatures DerivingStrategies FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving InstanceSigs KindSignatures MultiParamTypeClasses PolyKinds ScopedTypeVariables TypeApplications TypeFamilies TypeInType UndecidableInstances+  default-extensions:+      ConstraintKinds+      DataKinds+      DefaultSignatures+      DerivingStrategies+      FlexibleContexts+      FlexibleInstances+      GADTs+      GeneralizedNewtypeDeriving+      InstanceSigs+      KindSignatures+      MultiParamTypeClasses+      PolyKinds+      ScopedTypeVariables+      TypeApplications+      TypeFamilies+      TypeInType+      UndecidableInstances   ghc-options: -Wall   build-depends:       base >=4.7 && <5@@ -79,7 +97,24 @@       Paths_subcategories   hs-source-dirs:       test-  default-extensions: ConstraintKinds DataKinds DefaultSignatures DerivingStrategies FlexibleContexts FlexibleInstances GADTs GeneralizedNewtypeDeriving InstanceSigs KindSignatures MultiParamTypeClasses PolyKinds ScopedTypeVariables TypeApplications TypeFamilies TypeInType UndecidableInstances+  default-extensions:+      ConstraintKinds+      DataKinds+      DefaultSignatures+      DerivingStrategies+      FlexibleContexts+      FlexibleInstances+      GADTs+      GeneralizedNewtypeDeriving+      InstanceSigs+      KindSignatures+      MultiParamTypeClasses+      PolyKinds+      ScopedTypeVariables+      TypeApplications+      TypeFamilies+      TypeInType+      UndecidableInstances   ghc-options: -Wall -fno-hpc   build-tool-depends:       tasty-discover:tasty-discover
test/Control/Subcategory/FoldableSpec.hs view
@@ -16,6 +16,8 @@ import           Shared import           Test.Inspection import           Test.Tasty+import Data.Function ((&))+import Test.Tasty.ExpectedFailure (expectFailBecause)  cfoldr_uvec :: (Int -> b -> b) -> b -> U.Vector Int -> b cfoldr_uvec = cfoldr@@ -80,7 +82,9 @@       )     , $(inspecting "has no instance dictionary other than Unbox (if polymorphic)"       $ 'cfoldr_uvec_poly `hasNoTypeClassesExcept` [''U.Unbox]-      )+      ) & if ghcVer >= GHC9_0+      then expectFailBecause "Simplified subsumption sacrifices this and fails for GHC >= 9.0.1."+      else id     ]   , testGroup "SVector"     [ $(inspecting "has the same representation as S.foldr (if an element is concrete)"@@ -88,15 +92,19 @@       )     , $(inspecting "has no instance dictionary other than Storable (if polymorphic)"       $ 'cfoldr_svec_poly `hasNoTypeClassesExcept` [''S.Storable]-      )+      ) & if ghcVer >= GHC9_0+      then expectFailBecause "Simplified subsumption sacrifices this and fails for GHC >= 9.0.1."+      else id     ]   , testGroup "PVector"     [ $(inspecting "has the same representation as P.foldr (if an element is concrete)"         $ 'cfoldr_pvec ==- 'foldr_pvec       )-    , $(inspecting "has no instance dictionary other than Storable (if polymorphic)"+    , $(inspecting "has no instance dictionary other than Prim (if polymorphic)"       $ 'cfoldr_pvec_poly `hasNoTypeClassesExcept` [''P.Prim]-      )+      ) & if ghcVer >= GHC9_0+      then expectFailBecause "Simplified subsumption sacrifices this and fails for GHC >= 9.0.1."+      else id     ]   ] 
test/Control/Subcategory/FunctorSpec.hs view
@@ -100,6 +100,9 @@ map_Set :: Ord b => (Int -> b) -> Set Int -> Set b map_Set = Set.map +map_Set_eta :: Ord b => (Int -> b) -> Set Int -> Set b+map_Set_eta a b = Set.map a b+ cmap_HashSet   :: (Hashable b, Eq b)   => (String -> Maybe b) -> HashSet String -> HashSet (Maybe b)@@ -198,7 +201,7 @@     ]   , testGroup "Set"     [ $(inspecting "has the same representation as Set.map"-      $ 'cmap_Set ==- 'map_Set+      $ 'cmap_Set ==- if ghcVer >= GHC9_0 then 'map_Set_eta else 'map_Set       )     , $(inspecting "has no instance dictionary except Ord"       $ 'cmap_Set `hasNoTypeClassesExcept` [''Ord]
test/Shared.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-} module Shared where import Control.Exception import Data.Maybe          (listToMaybe)@@ -17,3 +18,19 @@ inspecting :: String -> Obligation -> Q Exp inspecting desc reg =   [|testCase desc $ checkInspection $(inspectTest reg)|]++data GHCVer = GHC8_8 | GHC8_10 | GHC9_0 | GHC9_2+  deriving (Show, Eq, Ord)++ghcVer :: GHCVer+#if __GLASGOW_HASKELL__ == 902+ghcVer = GHC9_2+#elif __GLASGOW_HASKELL__ == 900+ghcVer = GHC9_0+#elif __GLASGOW_HASKELL__ == 810+ghcVer = GHC8_10+#elif __GLASGOW_HASKELL__ == 808+ghcVer = GHC8_8+#else+ghcVer = error "Coudld not determine GHC Version: __GLASGOW_HASKELL__"+#endif