distributive 0.3.2 → 0.4
raw patch · 3 files changed
+17/−2 lines, 3 filesdep +tagged
Dependencies added: tagged
Files
- CHANGELOG.markdown +4/−0
- distributive.cabal +2/−1
- src/Data/Distributive.hs +11/−1
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+0.4+---+* Added support for `Data.Tagged` and `Data.Proxy`.+ 0.3.1 ----- * Minor documentation fix
distributive.cabal view
@@ -1,6 +1,6 @@ name: distributive category: Data Structures-version: 0.3.2+version: 0.4 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -33,6 +33,7 @@ library build-depends: base >= 4 && < 5,+ tagged >= 0.7 && < 1, transformers >= 0.2 && < 0.4, transformers-compat >= 0.1 && < 0.2
src/Data/Distributive.hs view
@@ -25,9 +25,11 @@ import Data.Functor.Identity import Data.Functor.Product import Data.Functor.Reverse+import Data.Proxy+import Data.Tagged --- | This is the categorical dual of 'Traversable'. +-- | This is the categorical dual of 'Traversable'. -- -- Due to the lack of non-trivial comonoids in Haskell, we can restrict -- ourselves to requiring a 'Functor' rather than@@ -85,6 +87,14 @@ instance Distributive Identity where collect f = Identity . fmap (runIdentity . f) distribute = Identity . fmap runIdentity++instance Distributive Proxy where+ collect _ _ = Proxy+ distribute _ = Proxy++instance Distributive (Tagged t) where+ collect f = Tagged . fmap (unTagged . f)+ distribute = Tagged . fmap unTagged instance Distributive ((->)e) where distribute a e = fmap ($e) a