module Control.Monad.Trans.Writer.CPS.Lens where
import Control.Lens
import Control.Lens.Internal.Zoom
import Control.Monad.Trans.Writer.CPS.Internal as Strict
import Control.Monad.Writer.CPS as Strict
import Data.Profunctor.Unsafe
instance (Monoid w, Functor m, t ~ Strict.WriterT w' m' a') => Rewrapped (Strict.WriterT w m a) t
instance (Monoid w, Functor m) => Wrapped (Strict.WriterT w m a) where
type Unwrapped (Strict.WriterT w m a) = m (a, w)
_Wrapped' = iso Strict.runWriterT Strict.writerT
type instance Zoomed (Strict.WriterT w m) = FocusingPlus w (Zoomed m)
instance Zoom m n s t => Zoom (Strict.WriterT w m) (Strict.WriterT w n) s t where
zoom l (Strict.WriterT m) = Strict.WriterT $ \w ->
zoom (\afb -> unfocusingPlus #. l (FocusingPlus #. afb)) (m w)