Skip to content

Commit

Permalink
Added Zoom ContT, cleaned up docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ekmett committed Aug 15, 2012
1 parent c8b7ae4 commit 44578f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Control/Lens/Getter.hs
Expand Up @@ -358,7 +358,7 @@ class (MonadReader b m, MonadReader a n) => Magnify m n b a | m -> b, n -> a, m
--
-- This acts like 'Control.Monad.Reader.Class.local', but can in many cases change the type of the environment as well.
--
-- This is commonly used to lift actions in a simpler Reader monad into a state monad with a larger state type.
-- This is commonly used to lift actions in a simpler Reader monad into a monad with a larger environment type.
--
-- This can be used to edit pretty much any monad transformer stack with an environment in it:
--
Expand Down
10 changes: 5 additions & 5 deletions src/Control/Lens/Type.hs
Expand Up @@ -116,7 +116,7 @@ import Control.Monad.Trans.Writer.Strict as Strict
import Control.Monad.Trans.RWS.Lazy as Lazy
import Control.Monad.Trans.RWS.Strict as Strict
import Control.Monad.Trans.Reader
-- import Control.Monad.Trans.Cont
import Control.Monad.Trans.Cont
import Control.Monad.Trans.Error
import Control.Monad.Trans.List
import Control.Monad.Trans.Identity
Expand Down Expand Up @@ -417,12 +417,12 @@ instance Zoom m n s t => Zoom (IdentityT m) (IdentityT n) s t where
instance Zoom m n s t => Zoom (MaybeT m) (MaybeT n) s t where
zoom l (MaybeT m) = MaybeT (zoom l m)

{-
instance Zoom m m a a => Zoom (ContT r m) (ContT r m) a a where
zoom l (ContT m) = ContT $ \k -> do
IndexedState ba a <- State.gets (l (IndexedState id))
...
-}
f <- State.state $ \s -> case l (IndexedStore id) s of
IndexedStore f t -> (f, t)
r <- m k
State.state $ \t -> (r, f t)

-------------------------------------------------------------------------------
-- Common Lenses
Expand Down

0 comments on commit 44578f0

Please sign in to comment.