@@ -46,55 +46,49 @@ type State tag r = StateT tag r Identity
46-- the final state of the first computation as the initial state of the second.
46-- the final state of the first computation as the initial state of the second.
47type StateT tag s = TT tag (Trans.StateT s)
47type StateT tag s = TT tag (Trans.StateT s)
49−tagged :: proxy tag -> Trans.StateT s m a -> StateT tag s m a
52−untagged :: proxy tag -> StateT tag s m a -> Trans.StateT s m a
55-- | Constructor for computations in the state monad transformer.
49-- | Constructor for computations in the state monad transformer.
56stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a
50stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a
57−stateT t = tagged t . Trans.StateT
51+stateT _ = pack . Trans.StateT
59-- | Constructor for computations in the state monad
53-- | Constructor for computations in the state monad
60-- (the inverse of 'runState').
54-- (the inverse of 'runState').
61state :: Monad m => proxy tag -> (s -> (a, s)) -> StateT tag s m a
55state :: Monad m => proxy tag -> (s -> (a, s)) -> StateT tag s m a
62−state t = tagged t . Trans.state
56+state _ = pack . Trans.state
64-- | Runs a 'StateT' with the given initial state
58-- | Runs a 'StateT' with the given initial state
65-- and returns both the final value and the final state.
59-- and returns both the final value and the final state.
66runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s)
60runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s)
67−runStateT t = Trans.runStateT . untagged t
61+runStateT _ = Trans.runStateT . unpack
69-- | Runs a 'StateT' with the given initial state
63-- | Runs a 'StateT' with the given initial state
70-- and returns the final value, discarding the final state.
64-- and returns the final value, discarding the final state.
71evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a
65evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a
72−evalStateT t = Trans.evalStateT . untagged t
66+evalStateT _ = Trans.evalStateT . unpack
74-- | Runs a 'StateT' with the given initial state
68-- | Runs a 'StateT' with the given initial state
75-- and returns the final state, discarding the final value.
69-- and returns the final state, discarding the final value.
76execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s
70execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s
77−execStateT t = Trans.execStateT . untagged t
71+execStateT _ = Trans.execStateT . unpack
79-- | Runs a 'State' with the given initial state
73-- | Runs a 'State' with the given initial state
80-- and returns both the final value and the final state.
74-- and returns both the final value and the final state.
81runState :: proxy tag -> State tag s a -> s -> (a, s)
75runState :: proxy tag -> State tag s a -> s -> (a, s)
82−runState t = Trans.runState . untagged t
76+runState _ = Trans.runState . unpack
84-- | Runs a 'State' with the given initial state
78-- | Runs a 'State' with the given initial state
85-- and returns the final value, discarding the final state.
79-- and returns the final value, discarding the final state.
86evalState :: proxy tag -> State tag s a -> s -> a
80evalState :: proxy tag -> State tag s a -> s -> a
87−evalState t = Trans.evalState . untagged t
81+evalState _ = Trans.evalState . unpack
89-- | Runs a 'State' with the given initial state
83-- | Runs a 'State' with the given initial state
90-- and returns the final state, discarding the final value.
84-- and returns the final state, discarding the final value.
91execState :: proxy tag -> State tag s a -> s -> s
85execState :: proxy tag -> State tag s a -> s -> s
92−execState t = Trans.execState . untagged t
86+execState _ = Trans.execState . unpack
94-- | Fetch the current value of the state within the monad.
88-- | Fetch the current value of the state within the monad.
95get :: Monad m => proxy tag -> StateT tag s m s
89get :: Monad m => proxy tag -> StateT tag s m s
96−get t = tagged t Trans.get
90+get _ = pack Trans.get
98-- | Set the value of the state within the monad.
92-- | Set the value of the state within the monad.
99put :: Monad m => proxy tag -> s -> StateT tag s m ()
93put :: Monad m => proxy tag -> s -> StateT tag s m ()
100−put t = tagged t . Trans.put
94+put _ = pack . Trans.put