packages feed

data-lens 2.10.7 → 2.11.2

raw patch · 3 files changed

Files

CHANGELOG view
@@ -1,3 +1,23 @@+2.11.2 (Changes from 2.11.2)+=========================+* Bump dependency on semigroupoids++2.11.1 (Changes from 2.11.0.1)+=========================+* Missing imports prevened data-lens from working on base earlier than 4.8.  This is now fixed.++2.11.0.1 (Changes from 2.11)+=========================+* Bump lower bound on transformers++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.2 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.3,+    transformers         >= 0.4     && < 0.6    extensions: CPP 
src/Data/Lens/Partial/Common.hs view
@@ -8,20 +8,21 @@ 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 Data.Monoid (Monoid, mempty)+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 +59,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 +126,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)