name: lens category: Data, Lenses version: 2.4 x-revision: 1 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett stability: provisional homepage: http://github.com/ekmett/lens/ bug-reports: http://github.com/ekmett/lens/issues copyright: Copyright (C) 2012 Edward A. Kmett synopsis: Lenses, Folds and Traversals description: This package comes \"Batteries Included\" with many useful lenses for the types commonly used from the Haskell Platform, and with tools for automatically generating lenses and isomorphisms for user-supplied data types. . The combinators in @Control.Lens@ provide a highly generic toolbox for composing families of getters, folds, isomorphisms, traversals, setters and lenses and their indexed variants. . More information on the care and feeding of lenses, including a tutorial and motivation for their types can be found on the lens wiki. . . A small game that manages its state using lenses can be found in the example folder. . . /Lenses, Folds and Traversals/ . The core of this hierarchy looks like: . <> . You can compose any two elements of the hierarchy above using (.) from the Prelude, and you can use any element of the hierarchy as any type it links to above it. . The result is their lowest upper bound in the hierarchy (or an error if that bound doesn't exist). . For instance: . * You can use any 'Traversal' as a 'Fold' or as a 'Setter'. . * The composition of a 'Traversal' and a 'Getter' yields a 'Fold'. . /Minimizing Dependencies/ . If you want to provide lenses and traversals for your own types in your own libraries, then you can do so without incurring a dependency on this (or any other) lens package at all. . e.g. for a data type: . > data Foo a = Foo Int Int a . You can define lenses such as . > -- bar :: Simple Lens (Foo a) Int > bar :: Functor f => (Int -> f Int) -> Foo a -> f Foo a > bar f (Foo a b c) = fmap (\a' -> Foo a' b c) (f a) . > -- baz :: Lens (Foo a) (Foo b) a b > quux :: Functor f => (a -> f b) -> Foo a -> f (Foo b) > quux f (Foo a b c) = fmap (Foo a b) (f c) . without the need to use any type that isn't already defined in the @Prelude@. . And you can define a traversal of multiple fields with 'Control.Applicative.Applicative': . > -- traverseBarAndBaz :: Simple Traversal (Foo a) Int > traverseBarAndBaz :: Applicative f => (Int -> f Int) -> Foo a -> f (Foo a) > traverseBarAndBaz f (Foo a b c) = Foo <$> f a <*> f b <*> pure c . What is provided in this library is a number of stock lenses and traversals for common haskell types, a wide array of combinators for working them, and more exotic functionality, (e.g. getters, setters, indexed folds, isomorphisms). build-type: Simple tested-with: GHC == 7.4.1 extra-source-files: .travis.yml .ghci .gitignore .vim.custom config examples/LICENSE examples/lens-examples.cabal examples/pong.hs README.markdown CHANGELOG.markdown source-repository head type: git location: git://github.com/ekmett/lens.git library build-depends: base >= 4.3 && < 4.6, containers >= 0.4.2 && < 0.6, mtl >= 2.1.1 && < 2.2, template-haskell >= 2.4 && < 2.9, transformers >= 0.3 && < 0.4 exposed-modules: Control.Exception.Lens Control.Lens Control.Lens.Action Control.Lens.Fold Control.Lens.Getter Control.Lens.Indexed Control.Lens.IndexedGetter Control.Lens.IndexedFold Control.Lens.IndexedLens Control.Lens.IndexedSetter Control.Lens.IndexedTraversal Control.Lens.Internal Control.Lens.Iso Control.Lens.Isomorphic Control.Lens.Representable Control.Lens.Setter Control.Lens.TH Control.Lens.Traversal Control.Lens.Tuple Control.Lens.Type Control.Lens.Zoom Data.Bits.Lens Data.Complex.Lens Data.Dynamic.Lens Data.Either.Lens Data.List.Lens Data.Pair.Lens Data.IntMap.Lens Data.IntSet.Lens Data.Map.Lens Data.Monoid.Lens Data.Sequence.Lens Data.Set.Lens Data.Tree.Lens Language.Haskell.TH.Lens -- platform build-depends: array >= 0.3.0.2 && < 0.5 exposed-modules: Data.Array.Lens build-depends: filepath >= 1.2.0.0 && < 1.4 exposed-modules: System.FilePath.Lens build-depends: bytestring >= 0.9.1.10 && < 0.11 exposed-modules: Data.ByteString.Lens Data.ByteString.Lazy.Lens build-depends: text >= 0.11.1.5 && < 0.12 exposed-modules: Data.Text.Lens Data.Text.Lazy.Lens build-depends: parallel >= 3.1.0.1 && < 3.3 exposed-modules: Control.Parallel.Strategies.Lens Control.Seq.Lens other-extensions: BangPatterns CPP DeriveDataTypeable FlexibleContexts FlexibleInstances FunctionalDependencies LiberalTypeSynonyms MultiParamTypeClasses Rank2Types RankNTypes TemplateHaskell TypeFamilies TypeOperators UndecidableInstances if (impl(ghc>=7.4)) other-extensions: Trustworthy build-depends: ghc-prim exposed-modules: GHC.Generics.Lens ghc-options: -Wall -fwarn-tabs -O2 -fdicts-cheap -funbox-strict-fields hs-source-dirs: src -- Verify the results of the examples test-suite doctests type: exitcode-stdio-1.0 main-is: doctests.hs build-depends: base == 4.*, directory >= 1.0 && < 1.2, doctest >= 0.8 && <= 0.9, filepath >= 1.3 && < 1.4 ghc-options: -Wall -Werror -threaded hs-source-dirs: tests -- Verify that Template Haskell expansion works test-suite templates type: exitcode-stdio-1.0 main-is: templates.hs build-depends: base == 4.*, lens ghc-options: -Wall -Werror -threaded hs-source-dirs: tests -- Verify the properties of lenses with QuickCheck test-suite properties type: exitcode-stdio-1.0 main-is: properties.hs build-depends: base == 4.*, lens, QuickCheck >= 2.4 && < 2.6, transformers >= 0.3 && < 0.5 ghc-options: -w -threaded hs-source-dirs: tests