representable-profunctors 0.1.0.2 → 0.2.0
raw patch · 3 files changed
+20/−3 lines, 3 filesdep +profunctor-extras
Dependencies added: profunctor-extras
Files
- Data/Profunctor/Corepresentable.hs +9/−1
- Data/Profunctor/Representable.hs +9/−1
- representable-profunctors.cabal +2/−1
Data/Profunctor/Corepresentable.hs view
@@ -4,9 +4,12 @@ ( CorepresentableProfunctor(..) ) where +import Data.Functor+import Data.Functor.Identity import Data.Profunctor import Control.Arrow-import Data.Functor.Identity+import qualified Data.Profunctor.Composition as Profunctor+import qualified Data.Functor.Compose as Functor class Functor (Corep k) => CorepresentableProfunctor k where type Corep k :: * -> *@@ -27,3 +30,8 @@ type Corep (UpStar f) = f cotabulatePro = UpStar coindexPro = runUpStar++instance (CorepresentableProfunctor c, CorepresentableProfunctor d) => CorepresentableProfunctor (Profunctor.Compose c d) where+ type Corep (Profunctor.Compose c d) = Functor.Compose (Corep c) (Corep d)+ cotabulatePro f = Profunctor.Compose (cotabulatePro (Functor.getCompose . f)) (cotabulatePro id)+ coindexPro (Profunctor.Compose f g) d = Functor.Compose $ coindexPro g <$> coindexPro f d
Data/Profunctor/Representable.hs view
@@ -3,9 +3,12 @@ ( RepresentableProfunctor(..) ) where +import Data.Functor+import Data.Functor.Identity+import qualified Data.Functor.Compose as Functor import Data.Profunctor+import qualified Data.Profunctor.Composition as Profunctor import Control.Comonad-import Data.Functor.Identity class Functor (Rep k) => RepresentableProfunctor k where type Rep k :: * -> *@@ -26,3 +29,8 @@ type Rep (DownStar f) = f tabulatePro = DownStar indexPro = runDownStar++instance (RepresentableProfunctor f, RepresentableProfunctor g) => RepresentableProfunctor (Profunctor.Compose f g) where+ type Rep (Profunctor.Compose f g) = Functor.Compose (Rep g) (Rep f)+ tabulatePro f = Profunctor.Compose (tabulatePro id) (tabulatePro (f . Functor.Compose))+ indexPro (Profunctor.Compose f g) (Functor.Compose d) = indexPro g $ indexPro f <$> d
representable-profunctors.cabal view
@@ -1,6 +1,6 @@ name: representable-profunctors category: Control, Categories-version: 0.1.0.2+version: 0.2.0 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -22,6 +22,7 @@ base >= 4 && < 5, comonad >= 1.1 && < 1.2, profunctors >= 0.1.1 && < 0.2,+ profunctor-extras >= 0.2 && < 0.3, transformers >= 0.2.2.0 && < 0.3 exposed-modules: