packages feed

lenz 0.1.2.2 → 0.2.0.0

raw patch · 3 files changed

+53/−53 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Data.Lens: fstL :: Lens (a, c) (b, c) a b
- Data.Lens: get :: ((a -> Const a b) -> α -> Const a β) -> α -> a
- Data.Lens: iso :: (α -> a) -> (b -> β) -> Lens α β a b
- Data.Lens: lens :: (α -> a) -> (b -> α -> β) -> Lens α β a b
- Data.Lens: modify :: ((a -> Identity b) -> α -> Identity β) -> (a -> b) -> α -> β
- Data.Lens: set :: ((a -> Identity b) -> α -> Identity β) -> b -> α -> β
- Data.Lens: sndL :: Lens (a, b) (a, c) b c
- Data.Lens: swapL :: Lens (a, b) (c, d) (b, a) (d, c)
- Data.Lens: type Lens α β a b = Refractor ((~) (->)) Functor α β a b
- Data.Lens: type Refractor c d α β a b = forall p f. (d f, c p) => p a (f b) -> p α (f β)
- Data.Lens: unitL :: Lens α α () ()
+ Control.Lens: fstL :: Lens (a, c) (b, c) a b
+ Control.Lens: get :: ((a -> Const a b) -> α -> Const a β) -> α -> a
+ Control.Lens: iso :: (α -> a) -> (b -> β) -> Lens α β a b
+ Control.Lens: lens :: (α -> a) -> (b -> α -> β) -> Lens α β a b
+ Control.Lens: modify :: ((a -> Identity b) -> α -> Identity β) -> (a -> b) -> α -> β
+ Control.Lens: set :: ((a -> Identity b) -> α -> Identity β) -> b -> α -> β
+ Control.Lens: sndL :: Lens (a, b) (a, c) b c
+ Control.Lens: swapL :: Lens (a, b) (c, d) (b, a) (d, c)
+ Control.Lens: type Lens α β a b = Refractor ((~) (->)) Functor α β a b
+ Control.Lens: type Traversal α β a b = Refractor ((~) (->)) Applicative α β a b
+ Control.Lens: type Refractor c d α β a b = forall p f. (d f, c p) => p a (f b) -> p α (f β)
+ Control.Lens: unitL :: Lens α α () ()

Files

+ Control/Lens.hs view
@@ -0,0 +1,51 @@+module Control.Lens (Lens, Refractor, Traversal,+                     lens, iso,+                     get, set, modify,+                     fstL, sndL, swapL, unitL) where++import Prelude hiding (id)++import Control.Applicative+import Control.Arrow+import Control.Category+import Control.Category.Unicode+import Data.Bits (Bits (..))+import Data.Bool (bool)+import Data.Functor.Identity+import Data.Tuple (swap)++type Refractor c d α β a b = ∀ p f . (d f, c p) ⇒ p a (f b) → p α (f β)++type Lens α β a b = Refractor ((~) (→)) Functor α β a b++type Traversal α β a b = Refractor ((~) (→)) Applicative α β a b++lens :: (α → a) → (b → α → β) → Lens α β a b+lens get set ret = liftA2 fmap (flip set) (ret ∘ get)++iso :: (α → a) → (b → β) → Lens α β a b+iso f g = (fmap g ∘) ∘ (∘ f)++get :: ((a → Const a b) → α → Const a β) → α → a+get l = getConst ∘ l Const++set :: ((a → Identity b) → α → Identity β) → b → α → β+set l = modify l ∘ pure++modify :: ((a → Identity b) → α → Identity β) → (a → b) → α → β+modify l f = runIdentity ∘ l (Identity ∘ f)++fstL :: Lens (a, c) (b, c) a b+fstL = swapL ∘ sndL++sndL :: Lens (a, b) (a, c) b c+sndL f = id *** f >>> uncurry (fmap ∘ (,))++swapL :: Lens (a, b) (c, d) (b, a) (d, c)+swapL = iso swap swap++unitL :: Lens α α () ()+unitL = lens (pure ()) (\ () -> id)++bitL :: Bits a => Int -> Lens a a Bool Bool+bitL = liftA2 lens (flip testBit) (flip (flip ∘ bool clearBit setBit))
− Data/Lens.hs
@@ -1,51 +0,0 @@-module Data.Lens (Lens, Refractor,-                  lens, iso,-                  get, set, modify,-                  fstL, sndL, swapL, unitL) where--import Prelude hiding (id)--import Control.Applicative-import Control.Arrow-import Control.Category-import Control.Category.Unicode-import Data.Bits (Bits (..))-import Data.Bool (bool)-import Data.Functor.Identity-import Data.Tuple (swap)--type Refractor c d α β a b = ∀ p f . (d f, c p) ⇒ p a (f b) → p α (f β)--type Lens α β a b = Refractor ((~) (→)) Functor α β a b--type Traversal α β a b = Refractor ((~) (→)) Applicative α β a b--lens :: (α → a) → (b → α → β) → Lens α β a b-lens get set ret = liftA2 fmap (flip set) (ret ∘ get)--iso :: (α → a) → (b → β) → Lens α β a b-iso f g = (fmap g ∘) ∘ (∘ f)--get :: ((a → Const a b) → α → Const a β) → α → a-get l = getConst ∘ l Const--set :: ((a → Identity b) → α → Identity β) → b → α → β-set l = modify l ∘ pure--modify :: ((a → Identity b) → α → Identity β) → (a → b) → α → β-modify l f = runIdentity ∘ l (Identity ∘ f)--fstL :: Lens (a, c) (b, c) a b-fstL = swapL ∘ sndL--sndL :: Lens (a, b) (a, c) b c-sndL f = id *** f >>> uncurry (fmap ∘ (,))--swapL :: Lens (a, b) (c, d) (b, a) (d, c)-swapL = iso swap swap--unitL :: Lens α α () ()-unitL = lens (pure ()) (\ () -> id)--bitL :: Bits a => Int -> Lens a a Bool Bool-bitL = liftA2 lens (flip testBit) (flip (flip ∘ bool clearBit setBit))
lenz.cabal view
@@ -1,5 +1,5 @@ name:           lenz-version:        0.1.2.2+version:        0.2.0.0 synopsis:       Van Laarhoven lenses license:        OtherLicense license-file:   LICENSE@@ -13,6 +13,6 @@                 GHC ==8.0.*  library-  exposed-modules:      Data.Lens+  exposed-modules:      Control.Lens   build-depends:        base >= 4.8 && <5, base-unicode-symbols >= 0.1 && <0.3, transformers >=0.2 && <0.6   extensions:           UnicodeSyntax, RankNTypes, ConstraintKinds, GADTs