lgtk 0.3 → 0.3.1
raw patch · 5 files changed
+22/−18 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.MLens: readRef :: Monad m => MLens m Unit a -> m a
+ Control.MLens: readRef :: Monad m => Ref m a -> m a
- Data.MLens.Ref: readRef :: Monad m => MLens m Unit a -> m a
+ Data.MLens.Ref: readRef :: Monad m => Ref m a -> m a
Files
- lgtk.cabal +1/−1
- src/Control/MLens.hs +11/−8
- src/Data/MLens.hs +3/−4
- src/Data/MLens/Ref.hs +3/−3
- src/GUI/MLens/Gtk.hs +4/−2
lgtk.cabal view
@@ -1,5 +1,5 @@ name: lgtk-version: 0.3+version: 0.3.1 category: GUI synopsis: lens-based GUI with Gtk backend description:
src/Control/MLens.hs view
@@ -9,6 +9,7 @@ -- * Lens operations , getL, setL, modL+ , readRef, writeRef, modRef -- * Lens transformations , fromLens, toLens@@ -18,7 +19,14 @@ , joinML, joinLens , memoMLens - -- * Pure lenses+ -- * Lens creation+ , lens+ , NewRef (..)+ , ExtRef (..)+ , Ext, runExt, runExt_++ -- * Derived constructs+ -- ** Pure lenses, built with @lens@ , id , unitLens , fstLens, sndLens@@ -26,17 +34,12 @@ , listLens , ithLens - -- * Impure lenses- , lens+ -- ** Impure lenses, built with @lens@ , forkLens , justLens , showLens - -- * Reference operations- , readRef, writeRef, modRef- , NewRef (..)- , ExtRef (..)- , Ext, runExt, runExt_+ -- ** Other derived construts , undoTr -- * Auxiliary definitions
src/Data/MLens.hs view
@@ -155,10 +155,10 @@ unitLens = lens (const ()) (const id) fstLens :: Monad m => MLens m (a,b) a-fstLens = MLens $ \(a,b) -> return (a, \a' -> return (a', b))+fstLens = lens fst $ \a (_,b) -> (a,b) sndLens :: Monad m => MLens m (a,b) b-sndLens = MLens $ \(a,b) -> return (b, \b' -> return (a, b'))+sndLens = lens snd $ \b (a,_) -> (a,b) maybeLens :: Monad m => MLens m (Bool, a) (Maybe a) maybeLens = lens (\(b,a) -> if b then Just a else Nothing)@@ -176,8 +176,7 @@ ithLens i = lens (!!i) $ \x xs -> take i xs ++ x : drop (i+1) xs forkLens :: (Monoid a, Monad m) => MLens m a (a, a)-forkLens = MLens $ \a ->- return ((a, a), \(a1, a2) -> return $ a1 `mappend` a2)+forkLens = lens (\a -> (a, a)) $ \(a1, a2) _ -> a1 `mappend` a2 justLens :: Monad m => a -> MLens m (Maybe a) a justLens a = lens (maybe a id) (const . Just)
src/Data/MLens/Ref.hs view
@@ -25,8 +25,8 @@ {- | The abstract data type @Unit@ is isomorphic to @()@,-but by making it abstract we can prevent using references-on the left hand side of lens composition.+but by making it abstract we can prevent using the same reference+on both sides of lens composition, which would have surprising effects. -} data Unit = Unit deriving (Eq, Show) @@ -54,7 +54,7 @@ -} type Ref m a = MLens m Unit a -readRef :: Monad m => MLens m Unit a -> m a+readRef :: Monad m => Ref m a -> m a readRef k = getL k Unit writeRef :: Monad m => Ref m a -> a -> m ()
src/GUI/MLens/Gtk.hs view
@@ -8,12 +8,14 @@ -- * GUI combinators , I (..) , ListLayout (..)- , vcat, hcat- , smartButton -- * Running GUI descriptions , runI , unsafeRunI++ -- * Derived constructs+ , vcat, hcat+ , smartButton -- * Auxiliary functions , toFree