adjunctions 4.4.2 → 4.4.3
raw patch · 13 files changed
+27/−133 lines, 13 filesdep −generic-derivingdep −ghc-primdep ~basedep ~containersdep ~transformersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies removed: generic-deriving, ghc-prim
Dependency ranges changed: base, containers, transformers
API changes (from Hackage documentation)
- Control.Monad.Representable.Reader: instance (Data.Semigroup.Foldable.Class.Foldable1 f, Data.Semigroup.Foldable.Class.Foldable1 m) => Data.Semigroup.Foldable.Class.Foldable1 (Control.Monad.Representable.Reader.ReaderT f m)
- Data.Functor.Contravariant.Rep: type family Rep f :: *;
- Data.Functor.Rep: type family Rep f :: *;
+ Control.Monad.Representable.Reader: instance (Data.Foldable1.Foldable1 f, Data.Foldable1.Foldable1 m) => Data.Foldable1.Foldable1 (Control.Monad.Representable.Reader.ReaderT f m)
+ Control.Monad.Representable.Reader: instance (Data.Functor.Rep.Representable f, GHC.Base.Monad m, Data.Functor.Rep.Rep f GHC.Types.~ e) => Control.Monad.Reader.Class.MonadReader e (Control.Monad.Representable.Reader.ReaderT f m)
+ Data.Functor.Contravariant.Rep: type Rep f :: *;
Files
- CHANGELOG.markdown +4/−0
- adjunctions.cabal +19/−23
- src/Control/Comonad/Representable/Store.hs +0/−3
- src/Control/Comonad/Trans/Adjoint.hs +0/−7
- src/Control/Monad/Representable/Reader.hs +2/−11
- src/Control/Monad/Representable/State.hs +0/−9
- src/Control/Monad/Trans/Adjoint.hs +0/−7
- src/Control/Monad/Trans/Contravariant/Adjoint.hs +0/−7
- src/Control/Monad/Trans/Conts.hs +0/−7
- src/Data/Functor/Adjunction.hs +0/−17
- src/Data/Functor/Contravariant/Adjunction.hs +1/−9
- src/Data/Functor/Rep.hs +0/−19
- tests/GenericsSpec.hs +1/−14
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+4.4.3 [2025.03.03]+------------------+* Drop support for pre-8.0 versions of GHC.+ 4.4.2 [2022.08.15] ------------------ * Fix the build with `mtl-2.3.1`.
adjunctions.cabal view
@@ -1,7 +1,7 @@ name: adjunctions category: Data Structures, Adjunctions-version: 4.4.2-license: BSD3+version: 4.4.3+license: BSD2 cabal-version: >= 1.10 license-file: LICENSE author: Edward A. Kmett@@ -19,22 +19,23 @@ HLint.hs CHANGELOG.markdown README.markdown-tested-with: GHC == 7.4.2- , GHC == 7.6.3- , GHC == 7.8.4- , GHC == 7.10.3- , GHC == 8.0.2+tested-with: GHC == 8.0.2 , GHC == 8.2.2 , GHC == 8.4.4 , GHC == 8.6.5 , GHC == 8.8.4 , GHC == 8.10.7 , GHC == 9.0.2- , GHC == 9.2.2+ , GHC == 9.2.8+ , GHC == 9.4.8+ , GHC == 9.6.6+ , GHC == 9.8.4+ , GHC == 9.10.1+ , GHC == 9.12.1 source-repository head type: git- location: git://github.com/ekmett/adjunctions.git+ location: https://github.com/ekmett/adjunctions.git library hs-source-dirs: src@@ -49,24 +50,21 @@ build-depends: array >= 0.3.0.2 && < 0.7,- base >= 4 && < 5,+ base >= 4.9 && < 5, comonad >= 4 && < 6,- containers >= 0.3 && < 0.7,+ containers >= 0.3 && < 0.9, contravariant >= 1 && < 2, distributive >= 0.5.1 && < 1, free >= 4 && < 6, mtl >= 2.0.1 && < 2.4, profunctors >= 4 && < 6, tagged >= 0.7 && < 1,- semigroupoids >= 4 && < 6,+ semigroupoids >= 4 && < 7, semigroups >= 0.11 && < 1,- transformers >= 0.2 && < 0.7,+ transformers >= 0.5.2 && < 0.7, transformers-compat >= 0.3 && < 1, void >= 0.5.5.1 && < 1 - if impl(ghc < 7.6)- build-depends: ghc-prim- exposed-modules: Control.Comonad.Representable.Store Control.Comonad.Trans.Adjoint@@ -84,13 +82,12 @@ default-language: Haskell2010 - if impl(ghc >= 8.0)- -- See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#base-4.9.0.0- ghc-options: -Wcompat -Wnoncanonical-monad-instances- ghc-options: -Wno-trustworthy-safe -Wno-inline-rule-shadowing+ -- See https://ghc.haskell.org/trac/ghc/wiki/Migration/8.0#base-4.9.0.0+ ghc-options: -Wcompat -Wnoncanonical-monad-instances+ ghc-options: -Wno-trustworthy-safe -Wno-inline-rule-shadowing - if !impl(ghc >= 8.8)- ghc-options: -Wnoncanonical-monadfail-instances+ if !impl(ghc >= 8.8)+ ghc-options: -Wnoncanonical-monadfail-instances if impl(ghc >= 8.6) ghc-options: -Wno-star-is-type@@ -104,7 +101,6 @@ adjunctions, base >= 4 && < 5, distributive >= 0.5.1 && < 1,- generic-deriving >= 1.11 && < 2, hspec >= 2 && < 3 main-is: Spec.hs
src/Control/Comonad/Representable/Store.hs view
@@ -30,9 +30,6 @@ , ComonadStore(..) ) where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Comonad import Control.Comonad.Cofree.Class import Control.Comonad.Env.Class
src/Control/Comonad/Trans/Adjoint.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-}-#if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 710-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2011-2013 Edward Kmett@@ -22,9 +18,6 @@ ) where import Prelude hiding (sequence)-#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Comonad import Control.Comonad.Trans.Class import Data.Functor.Adjunction
src/Control/Monad/Representable/Reader.hs view
@@ -1,5 +1,5 @@-{-# LANGUAGE GADTs, TypeFamilies, TypeOperators, CPP, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances, TypeSynonymInstances #-}-{-# OPTIONS_GHC -fenable-rewrite-rules -fno-warn-orphans #-}+{-# LANGUAGE GADTs, TypeFamilies, TypeOperators, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances, TypeSynonymInstances #-}+{-# OPTIONS_GHC -fenable-rewrite-rules -Wno-orphans #-} ---------------------------------------------------------------------- -- | -- Module : Control.Monad.Representable.Reader@@ -77,21 +77,12 @@ ReaderT fm >>- f = ReaderT $ tabulate (\a -> index fm a >>- flip index a . getReaderT . f) instance (Representable f, Monad m) => Monad (ReaderT f m) where-#if __GLASGOW_HASKELL__ < 710- return = ReaderT . pureRep . return-#endif ReaderT fm >>= f = ReaderT $ tabulate (\a -> index fm a >>= flip index a . getReaderT . f) -#if __GLASGOW_HASKELL >= 704- instance (Representable f, Monad m, Rep f ~ e) => MonadReader e (ReaderT f m) where ask = ReaderT (tabulate return) local f m = readerT $ \r -> runReaderT m (f r)-#if MIN_VERSION_transformers(0,3,0) reader = readerT . fmap return-#endif--#endif instance Representable f => MonadTrans (ReaderT f) where lift = ReaderT . pureRep
src/Control/Monad/Representable/State.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-}@@ -35,9 +34,6 @@ , MonadState(..) ) where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Monad import Data.Functor.Bind import Data.Functor.Bind.Trans@@ -148,9 +144,6 @@ StateT m >>- f = StateT $ fmap (>>- rightAdjunctRep (runStateT . f)) m instance (Representable g, Monad m) => Monad (StateT g m) where-#if __GLASGOW_HASKELL__ < 710- return = StateT . leftAdjunctRep return-#endif StateT m >>= f = StateT $ fmap (>>= rightAdjunctRep (runStateT . f)) m instance Representable f => BindTrans (StateT f) where@@ -162,9 +155,7 @@ instance (Representable g, Monad m, Rep g ~ s) => MonadState s (StateT g m) where get = stateT $ \s -> return (s, s) put s = StateT $ pureRep $ return ((),s)-#if MIN_VERSION_transformers(0,3,0) state f = stateT (return . f)-#endif instance (Representable g, MonadReader e m) => MonadReader e (StateT g m) where ask = lift ask
src/Control/Monad/Trans/Adjoint.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-}-#if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 710-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2011-2013 Edward Kmett@@ -22,9 +18,6 @@ ) where import Prelude hiding (sequence)-#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Monad (ap, liftM) import Control.Monad.Trans.Class import Data.Traversable
src/Control/Monad/Trans/Contravariant/Adjoint.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-}-#if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 710-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Trans.Contravariant.Adjoint@@ -35,9 +31,6 @@ ) where import Prelude hiding (sequence)-#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Comonad import Control.Monad (ap) import Data.Functor.Identity
src/Control/Monad/Trans/Conts.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-}-#if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 710-{-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2011-2013 Edward Kmett@@ -33,9 +29,6 @@ ) where import Prelude hiding (sequence)-#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Comonad import Control.Monad.Trans.Class import Control.Monad (ap)
src/Data/Functor/Adjunction.hs view
@@ -4,13 +4,8 @@ , TypeOperators , UndecidableInstances #-} -{-# LANGUAGE CPP #-}-#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif-#if __GLASGOW_HASKELL__ >= 708 {-# LANGUAGE EmptyCase #-}-#endif ------------------------------------------------------------------------------------------- -- |@@ -35,14 +30,8 @@ , splitL, unsplitL ) where -#if __GLASGOW_HASKELL__ < 710-import Control.Applicative-#endif import Control.Arrow ((&&&), (|||)) import Control.Monad.Free-#if __GLASGOW_HASKELL__ < 707-import Control.Monad.Instances ()-#endif import Control.Monad.Trans.Identity import Control.Monad.Trans.Reader import Control.Monad.Trans.Writer@@ -79,9 +68,7 @@ -- > leftAdjunct counit = id class (Functor f, Representable u) => Adjunction f u | f -> u, u -> f where-#if __GLASGOW_HASKELL__ >= 708 {-# MINIMAL (unit, counit) | (leftAdjunct, rightAdjunct) #-}-#endif unit :: a -> u (f a) counit :: f (u a) -> a leftAdjunct :: (f a -> b) -> a -> u b@@ -205,11 +192,7 @@ counit = absurdV1 absurdV1 :: V1 a -> b-#if __GLASGOW_HASKELL__ >= 708 absurdV1 x = case x of {}-#else-absurdV1 x = x `seq` undefined-#endif instance Adjunction Par1 Par1 where leftAdjunct f = Par1 . f . Par1
src/Data/Functor/Contravariant/Adjunction.hs view
@@ -1,8 +1,5 @@ {-# LANGUAGE Rank2Types, MultiParamTypeClasses, FunctionalDependencies, UndecidableInstances #-}-{-# LANGUAGE CPP #-}-#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-}-#endif ----------------------------------------------------------------------------- -- | -- Copyright : (C) 2011-2013 Edward Kmett@@ -21,9 +18,6 @@ , coindexAdjunction ) where -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 707-import Control.Monad.Instances ()-#endif import Data.Functor.Contravariant import Data.Functor.Contravariant.Rep import Data.Profunctor@@ -41,9 +35,7 @@ -- permit @unsafePerformIO@, and therefore does not exist. class (Contravariant f, Representable g) => Adjunction f g | f -> g, g -> f where-#if __GLASGOW_HASKELL__ >= 708 {-# MINIMAL (unit, counit) | (leftAdjunct, rightAdjunct) #-}-#endif unit :: a -> g (f a) -- monad in Hask counit :: a -> f (g a) -- comonad in Hask^op leftAdjunct :: (b -> f a) -> a -> g b@@ -59,7 +51,7 @@ -- This can be used with the combinators from the @lens@ package. -- -- @'adjuncted' :: 'Adjunction' f g => 'Iso'' (b -> f a) (a -> g b)@-adjuncted :: (Adjunction f g, Profunctor p, Functor h) +adjuncted :: (Adjunction f g, Profunctor p, Functor h) => p (a -> g b) (h (c -> g d)) -> p (b -> f a) (h (d -> f c)) adjuncted = dimap leftAdjunct (fmap rightAdjunct) {-# INLINE adjuncted #-}
src/Data/Functor/Rep.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE FlexibleContexts #-}@@ -79,9 +78,7 @@ import Control.Applicative import Control.Applicative.Backwards import Control.Arrow ((&&&))-#if __GLASGOW_HASKELL__ >= 708 import Data.Coerce-#endif import Control.Comonad import Control.Comonad.Trans.Class import Control.Comonad.Trans.Traced@@ -89,9 +86,7 @@ import Control.Monad.Fix (MonadFix(..)) import Control.Monad.Trans.Identity import Control.Monad.Reader (MonadReader(..), ReaderT(..))-#if MIN_VERSION_base(4,4,0) import Data.Complex-#endif import Data.Distributive import Data.Foldable (Foldable(fold)) import Data.Function@@ -108,9 +103,6 @@ import qualified Data.Sequence as Seq import Data.Semigroup hiding (Product) import Data.Tagged-#if !(MIN_VERSION_base(4,8,0))-import Data.Traversable (Traversable(sequenceA))-#endif import Data.Void import GHC.Generics hiding (Rep) import Prelude hiding (lookup)@@ -203,7 +195,6 @@ gindex' (Par1 a) () = a type instance GRep' (Rec1 f) = WrappedRep f-#if __GLASGOW_HASKELL__ >= 708 -- Using coerce explicitly here seems a bit more readable, and -- likely a drop easier on the simplifier. instance Representable f => GTabulate (Rec1 f) where@@ -212,12 +203,6 @@ instance Representable f => GIndex (Rec1 f) where gindex' = coerce (index :: f a -> Rep f -> a) :: forall a . Rec1 f a -> WrappedRep f -> a-#else-instance Representable f => GTabulate (Rec1 f) where- gtabulate' = Rec1 #. tabulate .# (. WrapRep)-instance Representable f => GIndex (Rec1 f) where- gindex' = (. unwrapRep) #. index .# unRec1-#endif type instance GRep' (M1 i c f) = GRep' f instance GTabulate f => GTabulate (M1 i c f) where@@ -413,12 +398,10 @@ index (Monoid.Sum s) () = s tabulate f = Monoid.Sum (f ()) -#if MIN_VERSION_base(4,4,0) instance Representable Complex where type Rep Complex = Bool index (r :+ i) key = if key then i else r tabulate f = f False :+ f True-#endif instance Representable U1 where type Rep U1 = Void@@ -476,11 +459,9 @@ return = pure (>>=) = bindRep -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 704 instance (Representable f, Rep f ~ a) => MonadReader a (Co f) where ask = askRep local = localRep-#endif instance (Representable f, Semigroup (Rep f)) => Extend (Co f) where extended = extendedRep
tests/GenericsSpec.hs view
@@ -1,10 +1,7 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE StandaloneDeriving #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE TypeFamilies #-} ---------------------------------------------------------------------- -- | -- Copyright : (c) Edward Kmett 2011-2014@@ -20,11 +17,7 @@ import Data.Distributive (Distributive(..)) import Data.Functor.Rep (Representable(..), WrappedRep(..)) -#if __GLASGOW_HASKELL__ >= 706-import Generics.Deriving.Base hiding (Rep)-#else-import qualified Generics.Deriving.TH as Generics (deriveAll1)-#endif+import GHC.Generics hiding (Rep) import Test.Hspec @@ -101,12 +94,6 @@ polyRecRep2 = Left (WrapRep (), WrapRep $ Left (WrapRep (), WrapRep $ Right ())) polyRecRep3 = Right () -#if __GLASGOW_HASKELL__ >= 706 deriving instance Generic1 Id deriving instance Generic1 Stream deriving instance Generic1 PolyRec-#else-$(Generics.deriveAll1 ''Id)-$(Generics.deriveAll1 ''Stream)-$(Generics.deriveAll1 ''PolyRec)-#endif