lenz 0.3.0.0 → 0.3.1.0
raw patch · 3 files changed
+33/−6 lines, 3 filessetup-changedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Lens: foldMapOf :: Monoid c => Getting c α β a b -> (a -> c) -> α -> c
+ Control.Lens: foldOf :: Monoid a => Getting a α β a b -> α -> a
+ Control.Lens: foldlOf :: Getting (Dual (Endo c)) α β a b -> (c -> a -> c) -> c -> α -> c
+ Control.Lens: foldrOf :: Getting (Endo c) α β a b -> (a -> c -> c) -> c -> α -> c
+ Control.Lens: mapAccumLOf :: ((a -> Backwards (State c) b) -> α -> Backwards (State c) β) -> (c -> a -> (c, b)) -> c -> α -> (c, β)
+ Control.Lens: mapAccumROf :: ((a -> State c b) -> α -> State c β) -> (a -> c -> (c, b)) -> c -> α -> (c, β)
+ Control.Lens: toListOf :: Getting (Endo [a]) α β a b -> α -> [a]
Files
- Control/Lens.hs +30/−0
- Setup.hs +0/−2
- lenz.cabal +3/−4
Control/Lens.hs view
@@ -1,16 +1,20 @@ module Control.Lens (Lens, Traversal, Iso, lens, iso, get, set, modify, mapping,+ foldMapOf, foldOf, toListOf, foldrOf, foldlOf, mapAccumLOf, mapAccumROf, fstL, sndL, swapL, unitL, bitL) where import Prelude hiding (id) import Control.Applicative+import Control.Applicative.Backwards (Backwards (..)) import Control.Category import Control.Category.Unicode+import Control.Monad.Trans.State (State, state, runState) import Data.Bits (Bits (..)) import Data.Bool (bool) import Data.Functor.Identity+import Data.Monoid (Dual (..), Endo (..)) import Data.Profunctor import Data.Tuple (swap) @@ -46,6 +50,32 @@ data Xchg a b α β = Xchg (α -> a) (b -> β) deriving (Functor) instance Profunctor (Xchg a b) where dimap f g (Xchg φ χ) = Xchg (φ ∘ f) (g ∘ χ)++foldOf :: Monoid a => Getting a α β a b -> α -> a+foldOf l = getConst ∘ l Const++foldMapOf :: Monoid c => Getting c α β a b -> (a -> c) -> α -> c+foldMapOf l f = getConst ∘ l (Const ∘ f)++toListOf :: Getting (Endo [a]) α β a b -> α -> [a]+toListOf l = flip appEndo [] ∘ getConst ∘ l (Const ∘ Endo ∘ (:))++foldrOf :: Getting (Endo c) α β a b -> (a -> c -> c) -> c -> α -> c+foldrOf l f z₀ = flip appEndo z₀ ∘ getConst ∘ l (Const ∘ Endo ∘ f)++foldlOf :: Getting (Dual (Endo c)) α β a b -> (c -> a -> c) -> c -> α -> c+foldlOf l f z₀ = flip appEndo z₀ ∘ getDual ∘ getConst ∘ l (Const ∘ Dual ∘ Endo ∘ flip f)++-- foldMapAccumOf :: Monoid c => ((a -> (c, b)) -> α -> (c, β)) -> (a -> (c, b)) -> α -> (c, β)+-- foldMapAccumOf = id++mapAccumROf :: ((a -> State c b) -> α -> State c β) -> (a -> c -> (c, b)) -> c -> α -> (c, β)+mapAccumROf l f z₀ = swap ∘ flip runState z₀ ∘ l (state ∘ (swap ∘) ∘ f)++mapAccumLOf :: ((a -> Backwards (State c) b) -> α -> Backwards (State c) β) -> (c -> a -> (c, b)) -> c -> α -> (c, β)+mapAccumLOf l f z₀ = swap ∘ flip runState z₀ ∘ forwards ∘ l (Backwards ∘ state ∘ (swap ∘) ∘ flip f)++type Getting r α β a b = (a -> Const r b) -> α -> Const r β fstL :: Lens (a, c) (b, c) a b fstL = swapL ∘ sndL
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
lenz.cabal view
@@ -1,5 +1,5 @@ name: lenz-version: 0.3.0.0+version: 0.3.1.0 synopsis: Van Laarhoven lenses license: BSD3 author: M Farkas-Dyck@@ -8,9 +8,8 @@ category: Data, Lenses build-type: Simple cabal-version: >=1.6-tested-with: GHC ==7.10.*,- GHC ==7.12.*,- GHC ==8.0.*+tested-with: GHC ==8.4.3+ , GHC ==8.6.4 library exposed-modules: Control.Lens