data-lens 2.10.7 → 2.11
raw patch · 3 files changed
+21/−21 lines, 3 filesdep ~basedep ~comonaddep ~semigroupoidsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, comonad, semigroupoids, transformers
API changes (from Hackage documentation)
- Control.Category.Product: instance Tensor (->)
- Data.Lens.Common: instance Category Lens
- Data.Lens.Common: instance Semigroupoid Lens
- Data.Lens.Common: instance Tensor Lens
- Data.Lens.Common: runLens :: Lens a b -> a -> Store b a
- Data.Lens.Partial.Common: instance Category PartialLens
- Data.Lens.Partial.Common: instance Tensor PartialLens
+ Control.Category.Product: instance Control.Category.Product.Tensor (->)
+ Data.Lens.Common: [runLens] :: Lens a b -> a -> Store b a
+ Data.Lens.Common: infixl 9 ^!
+ Data.Lens.Common: infixr 0 ^$!
+ Data.Lens.Common: infixr 4 ^!/=
+ Data.Lens.Common: instance Control.Category.Category Data.Lens.Common.Lens
+ Data.Lens.Common: instance Control.Category.Product.Tensor Data.Lens.Common.Lens
+ Data.Lens.Common: instance Data.Semigroupoid.Semigroupoid Data.Lens.Common.Lens
+ Data.Lens.Lazy: infixr 4 !||=
+ Data.Lens.Partial.Common: infixl 9 ^.
+ Data.Lens.Partial.Common: infixr 0 ^$
+ Data.Lens.Partial.Common: infixr 4 ^/=
+ Data.Lens.Partial.Common: instance Control.Category.Category Data.Lens.Partial.Common.PartialLens
+ Data.Lens.Partial.Common: instance Control.Category.Product.Tensor Data.Lens.Partial.Common.PartialLens
+ Data.Lens.Partial.Lazy: infixr 4 ||=
+ Data.Lens.Strict: infixr 4 !||=
- Data.Lens.Partial.Common: getorEmptyPL :: Monoid o => PartialLens a b -> (b -> o) -> a -> o
+ Data.Lens.Partial.Common: getorEmptyPL :: (Monoid o) => PartialLens a b -> (b -> o) -> a -> o
- Data.Lens.Partial.Common: productPL :: Num c => PartialLens a b -> (b -> c) -> a -> c
+ Data.Lens.Partial.Common: productPL :: (Num c) => PartialLens a b -> (b -> c) -> a -> c
- Data.Lens.Partial.Common: runPLens :: PartialLens a b -> a -> (Coproduct Identity (Store b)) a
+ Data.Lens.Partial.Common: runPLens :: PartialLens a b -> a -> (Sum Identity (Store b)) a
- Data.Lens.Partial.Common: sumPL :: Num c => PartialLens a b -> (b -> c) -> a -> c
+ Data.Lens.Partial.Common: sumPL :: (Num c) => PartialLens a b -> (b -> c) -> a -> c
Files
- CHANGELOG +8/−0
- data-lens.cabal +4/−12
- src/Data/Lens/Partial/Common.hs +9/−9
CHANGELOG view
@@ -1,3 +1,11 @@+2.11 (Changes from 2.10.7)+=========================+* Bump dependency on semigroupoids+* Bump dependency on transformers+* Bump dependency on comonad+ * Moving to comonad 0.5 requires moving from Data.Functor.Coproduct to Data.Functor.Sum.+ This requires a change in the signature for Data.Lens.Partial.Common.runPLens.+ 2.10.7 (Changes from 2.10.6) ========================= * Bump dependency on semigroupoids
data-lens.cabal view
@@ -1,6 +1,6 @@ name: data-lens category: Control, Comonads-version: 2.10.7+version: 2.11 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -18,21 +18,13 @@ type: git location: git://github.com/roconnor/data-lens.git -flag DeriveDataTypeable- manual: False- default: True- library build-depends: base >= 4 && < 5,- comonad >= 4.0 && < 4.3,+ comonad >= 4.0 && < 5.1, containers >= 0.3 && < 0.6,- semigroupoids >= 4.0 && < 5.1,- transformers >= 0.2.0 && < 0.5-- if flag(DeriveDataTypeable)- extensions: DeriveDataTypeable- cpp-options: -DLANGUAGE_DeriveDataTypeable+ semigroupoids >= 4.0 && < 5.2,+ transformers >= 0.2.0 && < 0.6 extensions: CPP
src/Data/Lens/Partial/Common.hs view
@@ -8,20 +8,20 @@ import Control.Comonad.Trans.Store import Data.Foldable (any, all) import Data.Functor.Identity-import Data.Functor.Coproduct+import Data.Functor.Sum import Data.Maybe-import Data.Monoid+import qualified Data.Monoid (Sum(..), Product(..)) newtype PartialLens a b = PLens (a -> Maybe (Store b a)) --- A partial lens is a coalgebra for the Coproduct Identity (Store b) comonad.-runPLens :: PartialLens a b -> a -> (Coproduct Identity (Store b)) a-runPLens (PLens f) a = maybe (left (Identity a)) right (f a)+-- A partial lens is a coalgebra for the Sum Identity (Store b) comonad.+runPLens :: PartialLens a b -> a -> (Sum Identity (Store b)) a+runPLens (PLens f) a = maybe (InL (Identity a)) InR (f a) instance Category PartialLens where id = totalLens id PLens f . PLens g = PLens $ \a -> do- (StoreT wba b) <- g a + (StoreT wba b) <- g a (StoreT wcb c) <- f b return (StoreT ((.) <$> wba <*> wcb) c) @@ -58,11 +58,11 @@ -- returns 0 in case of null sumPL :: (Num c) => PartialLens a b -> (b -> c) -> a -> c-sumPL l p = getSum . getorEmptyPL l (Sum . p)+sumPL l p = Data.Monoid.getSum . getorEmptyPL l (Data.Monoid.Sum . p) -- returns 1 in case of null productPL :: (Num c) => PartialLens a b -> (b -> c) -> a -> c-productPL l p = getProduct . getorEmptyPL l (Product . p)+productPL l p = Data.Monoid.getProduct . getorEmptyPL l (Data.Monoid.Product . p) anyPL :: PartialLens a b -> (b -> Bool) -> a -> Bool anyPL l p =@@ -125,7 +125,7 @@ justLens :: PartialLens (Maybe a) a justLens = PLens $ \ma -> do a <- ma- return (store Just a) + return (store Just a) leftLens :: PartialLens (Either a b) a leftLens = PLens $ either (Just . store Left) (const Nothing)