packages feed

lens-simple (empty) → 0.1.0.0

raw patch · 5 files changed

+189/−0 lines, 5 filesdep +basedep +lens-familydep +lens-family-coresetup-changed

Dependencies added: base, lens-family, lens-family-core, lens-family-th

Files

+ LICENSE view
@@ -0,0 +1,31 @@+Copyright 2012,2013,2014 Russell O'Connor+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 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 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+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.
+ Lens/Simple.hs view
@@ -0,0 +1,96 @@+{-#LANGUAGE CPP #-}+module Lens.Simple (+    -- * Stock Lenses+    _1, _2+    , chosen+    , ix+    , at, intAt+    , contains, intContains+    +    -- * Stock Traversals+    , both+    , _Left, _Right+    , _Just, _Nothing+    , ignored+    +    -- * Basic lens combinators+    , to, view, (^.)+    , folding, views, (^..), (^?)+    , toListOf, allOf, anyOf, firstOf, lastOf, sumOf, productOf+    , lengthOf, nullOf+    , backwards+    , over, (%~), set, (.~)+    , (&)+    +    -- * Pseudo-imperatives+    , (+~), (*~), (-~), (//~), (&&~), (||~), (<>~)+    +    -- * State related combinators+    , zoom+    , use, uses+    , (%=)+    , assign, (.=)+    , (%%=)+    , (<~)+    +    -- * Compound state assignments+    , (+=), (-=), (*=)+    , (//=)+    , (&&=), (||=)+    , (<>=)+    +    -- * Stock Semantic Editor Combinators+    , mapped+    +    -- * Lens formers+    , lens+    , iso+    , setting+    +    -- * Combining Combinators+    , choosing+    , alongside+    , beside++    -- * TH incantations+    , makeLenses+    , makeTraversals+    , makeLensesBy+    , makeLensesFor+    -- * Types+    +    , LensLike, LensLike'+    , FoldLike, FoldLike'+    , ASetter, ASetter'+    , Phantom+    , Constant, Identity+    , AlongsideLeft, AlongsideRight+    , Zooming+    +    +    -- * Re-exports+    , Applicative, Foldable, Monoid(..),(<>)+    , Backwards, All, Any, First, Last, Sum, Product+    , StateT, Writer+  ) where+import Lens.Family2.Unchecked+import Lens.Family2.Stock+import Lens.Family2.State.Strict+import Lens.Family2.TH (makeLenses, makeTraversals, makeLensesBy, makeLensesFor)+import Data.Monoid+#if MIN_VERSION_base(4,8,0)+import Data.Function ((&))+import Lens.Family hiding (Fold,(&))+#else+import Lens.Family hiding (Fold)+#endif++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 (??) #-}
+ README.md view
@@ -0,0 +1,5 @@+lens-simple+==================++This just re-exports the combinators and elementary lenses and traversals from the original 'van Laarhoven' lens library, Russell O'Connor's [`lens-family`](http://hackage.haskell.org/package/lens-family-core) package, including `Lens.Family.State.Strict`, and the corresponding TH module from Dan Burton's [`lens-family-th`](http://hackage.haskell.org/package/lens-family-th) so you can `makeLenses` and `makeTraversals` automatically.+
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ lens-simple.cabal view
@@ -0,0 +1,55 @@+name:                lens-simple+version:             0.1.0.0+synopsis:            simplified import of essential lens combinators++description:         This module, @Lens.Simple@, just re-exports the main modules from Russell O\'Connor's +                     <http://hackage.haskell.org/package/lens-family-core lens-family-core> +                     package, the original <http://r6.ca/blog/20120623T104901Z.html van Laarhoven lens> library. +                     @Lens.Simple@ also re-exports @makeLenses@ and +                     other TH incantations from Dan Burton's associated +                     <http://hackage.haskell.org/package/lens-family-th lens-family-th>. +                     .+                     The idea is just to make a lens-family equivalent of @import Control.Lens@, namely @import Lens.Simple@ +                     /-/- it's even one character shorter! As an illustration, note that +                     the <https://github.com/michaelt/lens-family-simple/blob/master/examples/Pong.hs pong example> +                     from the @lens@ library requires only this abbreviating change of imports. +                     .+                     Similarly, when need arises for the unfathomably more +                     sophisticated material in @Control.Lens@, a+                     change of imports will tend be all that is necessary +                     to begin using them. +                     .+                     It should be kept in mind that the @zoom@ exported here does+                     not use @MonadState@ from @mtl@ but is +                     specialized to @Control.Monad.Trans.State.Strict@  Many of+                     the other lenses and combinators are a bit more +                     specialized than their @Control.Lens@ equivalents: +                     for example, _1 and _2 are here +                     familiarly specialized to act just on real Haskell+                     pairs; with the loss of abstraction we also of course+                     lose the concomitant opaque error messages +                     about @Field1 s t a b@ etc.+                     +-- 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:           Copyright (C) 2012,2013,2014 Russell O'Connor, 2014 michaelt+category:            Lenses     +build-type:          Simple+extra-source-files:  README.md+cabal-version:       >=1.10+source-repository head+  type:     git+  location: https://github.com/michaelt/lens-simple    +    +library+  exposed-modules:     Lens.Simple+  build-depends:       base >= 4       && < 5+                       , lens-family == 1.2.*+                       , lens-family-core == 1.2.*+                       , lens-family-th == 0.4.*+  default-language:    Haskell2010