diff --git a/LICENSE b/LICENSE index 270dd9f..8c3e471 100644 --- a/LICENSE +++ b/LICENSE @@ -1,27 +1,30 @@ -Copyright (c) 2014, Michael Thompson +Copyright (c) 2014, michaelt + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. -* Neither the name of the {organization} nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. + * Neither the name of michaelt nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Lens/Simple.hs b/Lens/Simple.hs new file mode 100644 index 0000000..09c98c7 --- /dev/null +++ b/Lens/Simple.hs @@ -0,0 +1,21 @@ +module Lens.Simple ( + module Lens.Family2, + module Lens.Family2.Unchecked, + module Lens.Family2.Stock, + module Lens.Family2.State.Strict + ) where +import Lens.Family2 +import Lens.Family2.Unchecked +import Lens.Family2.Stock +import Lens.Family2.State.Strict + +infixl 1 ?? + +-- | Generalized infix flip, replicating Control.Lens.Lens.?? + +-- >>> execStateT ?? (0,"") $ do _1 += 1; _1 += 1; _2 <>= "hello" +-- (2,"hello") + +(??) :: Functor f => f (a -> b) -> a -> f b +ff ?? a = fmap ($ a) ff +{-# INLINE (??) #-} diff --git a/README.md b/README.md index d5e4e6b..e676c20 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ lens-simple =========== -lens-family re-exports, with "Lens.Family2.State.Strict" +This just re-exports the combinators and elementary 'van Laarhoven' lenses from Russell O'Connor's sublime [`lens-family`](http://hackage.haskell.org/package/lens-family) package, including "Lens.Family2.State.Strict". The naming in `lens-family` is now more or less uniform with the more powerful and elaborate [`lens`](http://hackage.haskell.org/package/lens) library. + +This package is merely intended to simplify imports -- just write `import Lens.Simple` -- for use with [`pipes`](http://hackage.haskell.org/package/pipes) and associated libraries, which frequently require that some version of `view/(^.)` and `zoom` should be in scope. Presumably much more should be hidden! diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/lens-simple.cabal b/lens-simple.cabal new file mode 100644 index 0000000..9198c5f --- /dev/null +++ b/lens-simple.cabal @@ -0,0 +1,22 @@ +name: lens-simple +version: 0.1.0.0 +synopsis: Re-exports sensible modules from Russell O'Connor's lens-family package. +-- description: +homepage: https://github.com/michaelt/lens-simple +license: BSD3 +license-file: LICENSE +author: michaelt +maintainer: what_is_it_to_do_anything@yahoo.com +-- copyright: +-- category: +build-type: Simple +extra-source-files: README.md +cabal-version: >=1.10 + +library + exposed-modules: Lens.Simple + -- other-modules: + -- other-extensions: + build-depends: base, lens-family >=1.0 + -- hs-source-dirs: + default-language: Haskell2010 \ No newline at end of file