lgtk 0.3.1 → 0.3.2
raw patch · 3 files changed
+19/−12 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.MLens: lensStore :: Monad m => (a -> (b, b -> a)) -> MLens m a b
+ Data.MLens: lensStore :: Monad m => (a -> (b, b -> a)) -> MLens m a b
Files
- lgtk.cabal +1/−1
- src/Control/MLens.hs +10/−7
- src/Data/MLens.hs +8/−4
lgtk.cabal view
@@ -1,5 +1,5 @@ name: lgtk-version: 0.3.1+version: 0.3.2 category: GUI synopsis: lens-based GUI with Gtk backend description:
src/Control/MLens.hs view
@@ -12,21 +12,20 @@ , readRef, writeRef, modRef -- * Lens transformations- , fromLens, toLens , mapMLens , (.) , (***)- , joinML, joinLens+ , joinML , memoMLens -- * Lens creation- , lens+ , lensStore , NewRef (..) , ExtRef (..) , Ext, runExt, runExt_ -- * Derived constructs- -- ** Pure lenses, built with @lens@+ -- ** Pure lenses, built with @lensStore@ , id , unitLens , fstLens, sndLens@@ -34,18 +33,22 @@ , listLens , ithLens - -- ** Impure lenses, built with @lens@+ -- ** Impure lenses, built with @lensStore@ , forkLens , justLens , showLens -- ** Other derived construts+ , lens+ , fromLens+ , toLens+ , joinLens , undoTr+ , memoRead+ , memoWrite -- * Auxiliary definitions , Morph- , memoRead- , memoWrite ) where import Control.Category
src/Data/MLens.hs view
@@ -8,6 +8,7 @@ , fromLens, toLens -- * Lens construction+ , lensStore , lens -- * Lens operations@@ -90,16 +91,19 @@ = MLens Identity a b fromLens :: Monad m => Lens a b -> MLens m a b-fromLens (MLens f) = MLens $ \x -> do- let (a, b) = runIdentity $ f x- return (a, \y -> return $ runIdentity $ b y)+fromLens = mapMLens (return . runIdentity) toLens :: (forall m . Monad m => MLens m a b) -> Lens a b toLens k = k -- | Impure (but effect-free) lens constuctor+lensStore :: Monad m => (a -> (b, b -> a)) -> MLens m a b+lensStore f = MLens $ return . g . f where+ g (b, ba) = (b, return . ba)++-- | Impure (but effect-free) lens constuctor, built on @lensStore@. lens :: Monad m => (a -> b) -> (b -> a -> a) -> MLens m a b-lens get set = MLens $ \a -> return (get a, return . flip set a)+lens get set = lensStore $ \a -> (get a, flip set a) getL :: Monad m => MLens m a b -> a -> m b getL (MLens f) a = f a >>= return . fst