packages feed

lenz (empty) → 0.1

raw patch · 4 files changed

+65/−0 lines, 4 filesdep +basedep +base-unicode-symbolsdep +transformerssetup-changed

Dependencies added: base, base-unicode-symbols, transformers

Files

+ Data/Lens.hs view
@@ -0,0 +1,43 @@+module Data.Lens (Lens,+                  lens, iso,+                  get, set, modify,+                  fstL, sndL, swapL) where++import Prelude hiding (id)++import Control.Applicative+import Control.Arrow+import Control.Category+import Control.Category.Unicode+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 :: Lens α β a b → α → a+get l = getConst ∘ l Const++set :: Lens α β a b → b → α → β+set l = modify l ∘ pure++modify :: Lens α β a b → (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
+ LICENSE view
@@ -0,0 +1,5 @@+© Unix year 44 (Strake = M Farkas-Dyck)++Leave to use, copy, modify, and distribute this work for any purpose is hereby granted if the above copyright notice and this license are included.++THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ lenz.cabal view
@@ -0,0 +1,15 @@+name:           lenz+version:        0.1+synopsis:       Van Laarhoven lenses+license:        OtherLicense+license-file:   LICENSE+author:	        M Farkas-Dyck+maintainer:     strake888@gmail.com+category:       Data, Lenses+build-type:     Simple+cabal-version:  >=1.4++library+  exposed-modules:      Data.Lens+  build-depends:        base >= 4.8 && <4.9, base-unicode-symbols >= 0.1 && <0.3, transformers >=0.2 && <0.6+  extensions:           UnicodeSyntax, RankNTypes, ConstraintKinds, GADTs