lens-simple 0.1.0.5 → 0.1.0.6
raw patch · 4 files changed
+42/−7 lines, 4 filesdep +mtldep ~transformers
Dependencies added: mtl
Dependency ranges changed: transformers
Files
- Lens/Simple.hs +17/−1
- README.md +1/−1
- changelog +18/−0
- lens-simple.cabal +6/−5
Lens/Simple.hs view
@@ -44,6 +44,7 @@ -- * Basic state related combinators: @zoom@, @use@, @assign\/(.=)@ etc. , zoom+ , zoom_ , use, uses , assign @@ -114,6 +115,8 @@ import Data.Monoid import Data.Functor.Identity import Data.Functor.Constant+import Control.Monad.Trans.State.Strict (StateT(..))+import Control.Monad.State.Strict #if MIN_VERSION_base(4,8,0) import Data.Function ((&)) import Lens.Family2 hiding ((&))@@ -132,6 +135,19 @@ {-# INLINE (??) #-} type SetterLike a a' b b' = LensLike Identity a a' b b'---+ (?~) :: 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
README.md view
@@ -1,5 +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.+`Lens-Simple` makes it easier to use 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. Despite its simplicity, this package has a rather complicated structure. The `zoom` preferred here is from `Lens.Family.State.Strict`. `makeLenses` and `makeTraversals` & co are re-exported from Dan Burton's [`lens-family-th`](http://hackage.haskell.org/package/lens-family-th).
+ changelog view
@@ -0,0 +1,18 @@+0.1.0.6+=======+ +* Added the (perhaps dubious) `zoom_`, generalizing `zoom` slightly to accord with certain a prioris.++0.1.0.3+=======++* Organized exports to make haddocked documentation more focussed.+* Added `(??)` and `(?~)`++0.1.0.0+=======++* First version. +++
lens-simple.cabal view
@@ -1,5 +1,5 @@ name: lens-simple-version: 0.1.0.5+version: 0.1.0.6 synopsis: simplified import of elementary lens-family combinators description: This module, <http://hackage.haskell.org/package/lens-simple/docs/Lens-Simple.html Lens.Simple>, @@ -70,16 +70,17 @@ copyright: 2012, 2013, 2014 Russell O'Connor; 2015 Michael Thompson category: Lenses build-type: Simple-extra-source-files: README.md+extra-source-files: README.md, changelog 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- , transformers < 4.3+ build-depends: base == 4.* + , transformers >= 0.2.0 && < 5+ , mtl >=2.1 && <2.3 , lens-family == 1.2.* , lens-family-core == 1.2.* , lens-family-th == 0.4.*