packages feed

lens-simple 0.1.0.7 → 0.1.0.8

raw patch · 2 files changed

+41/−42 lines, 2 files

Files

Lens/Simple.hs view
@@ -43,7 +43,6 @@          -- * Basic state-related combinators: @zoom@, @use@, @assign\/(.=)@ etc.     , zoom-    , zoom_     , use, uses     , assign     @@ -93,6 +92,8 @@     , Getter'     , Setter'     , FoldLike'+    , ASetter'+    , ASetter          -- * Helper classes     , Identical(..)@@ -109,6 +110,7 @@ import Lens.Family2.Unchecked import Lens.Family2.Stock import Lens.Family2.State.Strict+import Lens.Family (ASetter, ASetter', over) import Lens.Family2.TH (makeLenses, makeTraversals, makeLensesBy, makeLensesFor) import Data.Monoid import Data.Functor.Identity@@ -117,9 +119,9 @@ import Control.Monad.State.Strict #if MIN_VERSION_base(4,8,0) import Data.Function ((&))-import Lens.Family2 hiding ((&))+import Lens.Family2 hiding ((&), over) #else-import Lens.Family2 +import Lens.Family2 hiding (over) #endif  infixl 1 ??@@ -136,16 +138,3 @@  (?~) :: Setter a a' b (Maybe b') -> b' -> a -> a' l ?~ b = set l (Just b)---- | @zoom_@ is like @zoom@ but for convenience returns an @mtl@ style--- abstracted @MonadState@ state, rather than a concrete @StateT@, recapturing--- a bit more of the abstractness of @Control.Lens.zoom@ -zoom_-      :: MonadState s' m =>-         LensLike' (Zooming m a) s' s -> StateT s m a -> m a-zoom_ l f = abstract $ zoom l f  where-  abstract st  = do -    s <- get -    (a,s') <- runStateT st s-    put s'-    return a
lens-simple.cabal view
@@ -1,18 +1,24 @@ name:                lens-simple-version:             0.1.0.7+version:             0.1.0.8 synopsis:            simplified import of elementary lens-family combinators  description:         This module, <http://hackage.haskell.org/package/lens-simple/docs/Lens-Simple.html Lens.Simple>,                       just re-exports the main modules from Russell O\'Connor's-                     <http://hackage.haskell.org/package/lens-family lens-family> package.+                     <http://hackage.haskell.org/package/lens-family lens-family> package, the+                     original van Laarhoven-O'Connor lens library.                      @lens-family@ is particularly remarkable for its minute number of dependencies:-                     apart from <http://hackage.haskell.org/package/mtl mtl> -                     they are all ghc \'boot\' libraries.-                     @Lens.Simple@ also re-exports @makeLenses@ and -                     other convenient TH incantations from Dan Burton's associated -                     <http://hackage.haskell.org/package/lens-family-th lens-family-th>. +                     (apart from <http://hackage.haskell.org/package/mtl mtl> +                     they are all ghc \'boot\' libraries); but more importantly for its +                     extreme conceptual simplicity and theoretical soundness. Much of+                     the material it contains is well-explained, from a tutorial point of view, by+                     <http://hackage.haskell.org/package/lens-tutorial lens-tutorial> It is independent,+                     self-standing and readily intelligible apart from any darker+                     more general system of combinators that might attempt to extend it. Much+                     of it ought to be in the Prelude.                      .-                     The idea, then, is just to make a sort of low-powered, minimal-dependency, @lens-family@ equivalent of +                     Convenient import of the elementary combinators from @lens-family@, +                     however, a little complicated. The idea of this trivial module, then, is just to make a sort of +                     low-powered, minimal-dependency, @lens-family@ equivalent of                       the 800 lb gorilla of lens library imports:                      .                      > import Control.Lens@@ -23,39 +29,43 @@                      .                      Check it out, it's even one character shorter!                      .-                     As an illustration of the simplicity of the -                     fundamental van Laarhoven lens combinators - and their homogeneity with +                     The material in <http://hackage.haskell.org/package/lens-tutorial lens-tutorial>+                     will work fine if you make this substitution in the underlying +                     <http://hackage.haskell.org/package/lens-tutorial-1.0.0/docs/src/Control-Lens-Tutorial.html source>+                     and follow along as prompted.+                     .+                     As another illustration of the simplicity of the +                     fundamental van Laarhoven-O'Connor lens combinators - and their homogeneity with                       @Control.Lens@ - note that the gloss                      <https://github.com/michaelt/lens-family-simple/blob/master/examples/Pong.hs pong example>                       from the @lens@ library examples directory - which continues to be-                     the best introductory lens tutorial precisely by saying nothing --                     requires /only/ this abbreviating change of imports. +                     among the best introductory lens tutorials precisely by saying nothing -+                     requires only this abbreviating change of imports. +                     .                      If you make that program more complicated,                       you might of course end up needing                      the more sophisticated material in @Control.Lens@ and -                     its immense mass of dependencies.-                     Within its more limited sphere, though, @lens-family@ accords as -                     far as possible with @lens@, so this switch -                     will often be all that is necessary to begin using them. +                     its immense mass of dependencies. On the other hand, +                     you might just need some of the additional material+                     present in the similarly demystifying +                     <http://hackage.haskell.org/package/microlens microlens> +                     or <http://hackage.haskell.org/package/microlens-th microlens-th> and+                     the associated modules.                      .                      This module was originally intended to simplify the use of packages that -                     follow the original promise of the van Laarhoven lenses. +                     follow the original promise of the van Laarhoven-O'Connor lenses.                       /Correct practice is to export lenses without depending on a lens-library, where possible./                      In basic cases these just use familiar @Prelude@ types, after all.                       Examples of best practices in this respect are e.g. <http://hackage.haskell.org/package/lens-family-th lens-family-th> which                      doesn't depend on @lens-family@ despite its name and pipes-related packages like                      <http://hackage.haskell.org/package/pipes-bytestring pipes-bytestring>                       and <http://hackage.haskell.org/package/pipes-group pipes-group>. -                     Because of the heavily monadic character of the latter libraries, the -                     extra material in @Control.Lens@ is rarely of use anyway; one sticks largely-                     to @view@, @set@, @over@ and, for state operations, @zoom@.                      .-                     Note that lenses and other combinators are here frequently 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. -+                     @Lens.Simple@ also re-exports @makeLenses@ and +                     other convenient TH incantations from Dan Burton's associated +                     <http://hackage.haskell.org/package/lens-family-th lens-family-th>. +                     .+                      homepage:            https://github.com/michaelt/lens-simple license:             BSD3 license-file:        LICENSE