@@ -6,6 +6,7 @@
66{-# LANGUAGE DataKinds #-}
77{-# LANGUAGE PolyKinds #-}
88{-# LANGUAGE GeneralizedNewtypeDeriving #-}
9+{-# LANGUAGE MagicHash #-}
910
1011-- | See "Control.Monad.Trans.State.Strict".
1112
@@ -28,6 +29,7 @@ module Control.Monad.Trans.Ether.State.Strict
2829 , put
2930 ) where
3031
32+import GHC.Prim (Proxy#)
3133import Data.Functor.Identity (Identity(..))
3234import qualified Control.Monad.Trans.State.Strict as Trans
3335import Control.Monad.Trans.Ether.Tagged
@@ -47,48 +49,48 @@ type State tag r = StateT tag r Identity
4749type StateT tag s = TaggedTrans tag (Trans.StateT s)
4850
4951-- | Constructor for computations in the state monad transformer.
50−stateT :: proxy tag -> (s -> m (a, s)) -> StateT tag s m a
52+stateT :: Proxy# tag -> (s -> m (a, s)) -> StateT tag s m a
5153stateT _ = pack . Trans.StateT
5254
5355-- | Constructor for computations in the state monad
5456-- (the inverse of 'runState').
55−state :: Monad m => proxy tag -> (s -> (a, s)) -> StateT tag s m a
57+state :: Monad m => Proxy# tag -> (s -> (a, s)) -> StateT tag s m a
5658state _ = pack . Trans.state
5759
5860-- | Runs a 'StateT' with the given initial state
5961-- and returns both the final value and the final state.
60−runStateT :: proxy tag -> StateT tag s m a -> s -> m (a, s)
62+runStateT :: Proxy# tag -> StateT tag s m a -> s -> m (a, s)
6163runStateT _ = Trans.runStateT . unpack
6264
6365-- | Runs a 'StateT' with the given initial state
6466-- and returns the final value, discarding the final state.
65−evalStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m a
67+evalStateT :: Monad m => Proxy# tag -> StateT tag s m a -> s -> m a
6668evalStateT _ = Trans.evalStateT . unpack
6769
6870-- | Runs a 'StateT' with the given initial state
6971-- and returns the final state, discarding the final value.
70−execStateT :: Monad m => proxy tag -> StateT tag s m a -> s -> m s
72+execStateT :: Monad m => Proxy# tag -> StateT tag s m a -> s -> m s
7173execStateT _ = Trans.execStateT . unpack
7274
7375-- | Runs a 'State' with the given initial state
7476-- and returns both the final value and the final state.
75−runState :: proxy tag -> State tag s a -> s -> (a, s)
77+runState :: Proxy# tag -> State tag s a -> s -> (a, s)
7678runState _ = Trans.runState . unpack
7779
7880-- | Runs a 'State' with the given initial state
7981-- and returns the final value, discarding the final state.
80−evalState :: proxy tag -> State tag s a -> s -> a
82+evalState :: Proxy# tag -> State tag s a -> s -> a
8183evalState _ = Trans.evalState . unpack
8284
8385-- | Runs a 'State' with the given initial state
8486-- and returns the final state, discarding the final value.
85−execState :: proxy tag -> State tag s a -> s -> s
87+execState :: Proxy# tag -> State tag s a -> s -> s
8688execState _ = Trans.execState . unpack
8789
8890-- | Fetch the current value of the state within the monad.
89−get :: Monad m => proxy tag -> StateT tag s m s
91+get :: Monad m => Proxy# tag -> StateT tag s m s
9092get _ = pack Trans.get
9193
9294-- | Set the value of the state within the monad.
93−put :: Monad m => proxy tag -> s -> StateT tag s m ()
95+put :: Monad m => Proxy# tag -> s -> StateT tag s m ()
9496put _ = pack . Trans.put