@@ -41,6 +41,7 @@ import qualified Control.Newtype as NT
4141import qualified Control.Monad.Trans.Control as MC
4242import qualified Control.Monad.Trans.State.Strict as Trans
4343
44+import qualified Control.Monad.Trans.Lift.StT as Lift
4445import qualified Control.Monad.Trans.Lift.Local as Lift
4546import qualified Control.Monad.Trans.Lift.Catch as Lift
4647import qualified Control.Monad.Trans.Lift.Listen as Lift
@@ -66,7 +67,7 @@ type State tag r = StateT tag r Identity
6667--
6768-- The 'return' function leaves the state unchanged, while '>>=' uses
6869-- the final state of the first computation as the initial state of the second.
69−newtype StateT tag s m a = ST { runST :: Trans.StateT s m a }
70+newtype StateT tag s m a = StateT (Trans.StateT s m a)
7071 deriving ( Generic
7172 , Functor, Applicative, Alternative, Monad, MonadPlus
7273 , MonadFix, MonadTrans, MonadIO, MFunctor )
@@ -75,19 +76,26 @@ instance NT.Newtype (StateT tag s m a)
7576
7677instance MC.MonadTransControl (StateT tag s) where
7778 type StT (StateT tag s) a = MC.StT (Trans.StateT s) a
78− liftWith = MC.defaultLiftWith ST runST
79− restoreT = MC.defaultRestoreT ST
79+ liftWith = MC.defaultLiftWith NT.pack NT.unpack
80+ restoreT = MC.defaultRestoreT NT.pack
8081
81−instance Lift.LiftLocal (StateT tag s)
82−instance Lift.LiftCatch (StateT tag s)
83−instance Lift.LiftListen (StateT tag s)
82+type instance Lift.StT (StateT tag s) a = MC.StT (StateT tag s) a
83+
84+instance Lift.LiftLocal (StateT tag s) where
85+ liftLocal = Lift.defaultLiftLocal NT.pack NT.unpack
86+
87+instance Lift.LiftCatch (StateT tag s) where
88+ liftCatch = Lift.defaultLiftCatch NT.pack NT.unpack
89+
90+instance Lift.LiftListen (StateT tag s) where
91+ liftListen = Lift.defaultLiftListen NT.pack NT.unpack
8492
8593instance Lift.LiftPass (StateT tag s) where
86− liftPass pass m = ST $ Lift.liftPass pass (runST m)
94+ liftPass = Lift.defaultLiftPass NT.pack NT.unpack
8795
8896instance Lift.LiftCallCC (StateT tag s) where
89− liftCallCC callCC f = ST $ Lift.liftCallCC callCC (\g -> (runST . f) (ST . g))
90− liftCallCC' callCC f = ST $ Lift.liftCallCC' callCC (\g -> (runST . f) (ST . g))
97+ liftCallCC = Lift.defaultLiftCallCC NT.pack NT.unpack
98+ liftCallCC' = Lift.defaultLiftCallCC' NT.pack NT.unpack
9199
92100instance Taggable (StateT tag s m) where
93101 type Tag (StateT tag s m) = 'Just tag