mirror of
https://github.com/michaelt/lens-simple.git
synced 2024-10-05 17:47:42 +03:00
first commit
This commit is contained in:
parent
9158d5c12a
commit
505764afb5
41
LICENSE
41
LICENSE
@ -1,27 +1,30 @@
|
|||||||
Copyright (c) 2014, Michael Thompson
|
Copyright (c) 2014, michaelt
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are met:
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright notice, this
|
* Redistributions of source code must retain the above copyright
|
||||||
list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above copyright notice,
|
* Redistributions in binary form must reproduce the above
|
||||||
this list of conditions and the following disclaimer in the documentation
|
copyright notice, this list of conditions and the following
|
||||||
and/or other materials provided with the distribution.
|
disclaimer in the documentation and/or other materials provided
|
||||||
|
with the distribution.
|
||||||
|
|
||||||
* Neither the name of the {organization} nor the names of its
|
* Neither the name of michaelt nor the names of other
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived
|
||||||
this software without specific prior written permission.
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
21
Lens/Simple.hs
Normal file
21
Lens/Simple.hs
Normal file
@ -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 (??) #-}
|
@ -1,4 +1,6 @@
|
|||||||
lens-simple
|
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!
|
||||||
|
22
lens-simple.cabal
Normal file
22
lens-simple.cabal
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user