representable-functors 0.3.0.3 → 0.4.0
raw patch · 2 files changed
+8/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Functor.Representable: repLens :: Representable f => Lens a b -> Lens (f a) (f b)
Files
Data/Functor/Representable.hs view
@@ -18,6 +18,8 @@ ( -- * Representable Functors Representable(..)+ -- ** Representable Lenses+ , repLens -- * Default definitions -- ** Functor , fmapRep@@ -52,6 +54,7 @@ import Data.Functor.Compose import Data.Functor.Product import Data.Monoid hiding (Product)+import Data.Lens.Common import Prelude hiding (lookup) -- | A 'Functor' @f@ is 'Representable' if 'tabulate' and 'index' witness an isomorphism to @(->) x@.@@ -105,6 +108,10 @@ extractRep :: (Indexable f, Monoid (Key f)) => f a -> a extractRep fa = index fa mempty++-- | We extend lens across a representable functor, due to the preservation of limits.+repLens :: Representable f => Lens a b -> Lens (f a) (f b)+repLens l = lens (fmap (l ^$)) (liftA2 (l ^=)) -- * Instances
representable-functors.cabal view
@@ -1,6 +1,6 @@ name: representable-functors category: Monads, Functors, Data Structures-version: 0.3.0.3+version: 0.4.0 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE