Closed cnd closed 8 years ago
Since you already made a transformers
-related pull request, do you mind incorporating the changes needed to replace Data.Functor.Coproduct
with Data.Functor.Sum
? Here is a git diff
of the changes I made to your branch to make it work:
diff --git a/adjunctions.cabal b/adjunctions.cabal
index 62c4368..ee032a8 100644
--- a/adjunctions.cabal
+++ b/adjunctions.cabal
@@ -40,20 +40,21 @@ library
UndecidableInstances
build-depends:
- array >= 0.3.0.2 && < 0.7,
- base >= 4 && < 5,
- comonad >= 4 && < 5,
- containers >= 0.3 && < 0.6,
- contravariant >= 1 && < 2,
- distributive >= 0.4 && < 1,
- free >= 4 && < 5,
- mtl >= 2.0.1 && < 2.3,
- profunctors >= 4 && < 6,
- tagged >= 0.7 && < 1,
- semigroupoids >= 4 && < 6,
- semigroups >= 0.11 && < 1,
- transformers >= 0.2 && < 0.6,
- void >= 0.5.5.1 && < 1
+ array >= 0.3.0.2 && < 0.7,
+ base >= 4 && < 5,
+ comonad >= 4 && < 5,
+ containers >= 0.3 && < 0.6,
+ contravariant >= 1 && < 2,
+ distributive >= 0.4 && < 1,
+ free >= 4 && < 5,
+ mtl >= 2.0.1 && < 2.3,
+ profunctors >= 4 && < 6,
+ tagged >= 0.7 && < 1,
+ semigroupoids >= 4 && < 6,
+ semigroups >= 0.11 && < 1,
+ transformers >= 0.2 && < 0.6,
+ transformers-compat >= 0.3 && < 1,
+ void >= 0.5.5.1 && < 1
exposed-modules:
Control.Comonad.Representable.Store
diff --git a/src/Data/Functor/Adjunction.hs b/src/Data/Functor/Adjunction.hs
index 3ec3fd4..4e18d37 100644
--- a/src/Data/Functor/Adjunction.hs
+++ b/src/Data/Functor/Adjunction.hs
@@ -48,10 +48,10 @@ import Control.Comonad.Trans.Env
import Control.Comonad.Trans.Traced
import Data.Functor.Identity
-import Data.Functor.Coproduct
import Data.Functor.Compose
import Data.Functor.Product
import Data.Functor.Rep
+import Data.Functor.Sum
import Data.Profunctor
import Data.Void
@@ -89,7 +89,7 @@ class (Functor f, Representable u) =>
-- This can be used with the combinators from the @lens@ package.
--
-- @'adjuncted' :: 'Adjunction' f u => 'Iso'' (f a -> b) (a -> u b)@
-adjuncted :: (Adjunction f u, Profunctor p, Functor g)
+adjuncted :: (Adjunction f u, Profunctor p, Functor g)
=> p (a -> u b) (g (c -> u d)) -> p (f a -> b) (g (f c -> d))
adjuncted = dimap leftAdjunct (fmap rightAdjunct)
{-# INLINE adjuncted #-}
@@ -181,12 +181,10 @@ instance (Adjunction f g, Adjunction f' g') =>
counit = rightAdjunct (rightAdjunct getCompose) . getCompose
instance (Adjunction f g, Adjunction f' g') =>
- Adjunction (Coproduct f f') (Product g g') where
- unit a = Pair (leftAdjunct left a) (leftAdjunct right a)
- counit = coproduct (rightAdjunct fstP) (rightAdjunct sndP)
- where
- fstP (Pair x _) = x
- sndP (Pair _ x) = x
+ Adjunction (Sum f f') (Product g g') where
+ unit a = Pair (leftAdjunct InL a) (leftAdjunct InR a)
+ counit (InL l) = rightAdjunct (\(Pair x _) -> x) l
+ counit (InR r) = rightAdjunct (\(Pair _ x) -> x) r
instance Adjunction f u =>
Adjunction (Free f) (Cofree u) where
@RyanGlScott I'll be happy to accept it as gift
Oops, I just realized I had accidentially git diff
-ed the wrong branch of your adjunctions
fork. Fixed now.
I'll be happy to accept it as gift
I'm not sure what that means. Do you want me to open a pull request on your fork?
@RyanGlScott I mean commit your changes from my name XD
Oh, I see. I don't have push access for adjunctions
(just bifunctors
, free
, and lens
), so I can't do that.
@RyanGlScott you can open pull request if you want to commit it with your creditations or I will commit it as additional commit in this PR - up to you, diff doesn't contain credits... git patch should if I remember correctly
Well, you noticed the issue first, so I think it's fair that you get the credit for committing it. :)
also I think I can just grab with cherry-pick commit from your branch maybe
also I think I can just grab with cherry-pick commit from your branch maybe
OK. If you wish to do that, here's a commit from my fork.
@RyanGlScott it's easier just create PR from there :)
@RyanGlScott https://github.com/ekmett/adjunctions/pull/19
@RyanGlScott You now have access. Feel free to ping me if you need access to other repos.
Thanks, @ekmett. There's several other lens
dependencies that also need some work to be GHC 8.0–compliant: distributive
, contravariant
, comonad
, profunctors
, kan-extensions
, and either
. Can you add me on those?
Done. Go for it. I trust your judgment.
On Fri, Jan 15, 2016 at 11:18 AM, Ryan Scott notifications@github.com wrote:
Thanks, @ekmett https://github.com/ekmett. There's several other lens dependencies that also need some work to be GHC 8.0–compliant: distributive https://github.com/ekmett/distributive/pull/14, contravariant https://github.com/ekmett/contravariant/pull/22, comonad https://github.com/ekmett/comonad/pull/31, profunctors https://github.com/ekmett/profunctors/pull/35, kan-extensions https://github.com/ekmett/kan-extensions/pull/24, and either https://github.com/ekmett/either/pull/43. Can you add me on those?
— Reply to this email directly or view it on GitHub https://github.com/ekmett/adjunctions/pull/18#issuecomment-172004494.
issue in progress: https://github.com/ekmett/adjunctions/issues/17