module SPstateMonad where import SP(SP) import Spops import StateMonads(Mk(..),Ms(..),toMs,toMsc,loadMs,storeMs) type SPms i o s ans = Ms (SP i o) s ans putsSPms :: [o] -> SPms i o s () putSPms :: o -> SPms i o s () getSPms :: SPms i o s i nullSPms :: SPms i o s () loadSPms :: SPms i o s s storeSPms :: s -> SPms i o s () stateMonadSP :: s -> SPms i o s ans -> (ans -> SP i o) -> SP i o putsSPms :: forall o i s. [o] -> SPms i o s () putsSPms = forall k r. (k -> k) -> Msc k r toMsc forall b c a. (b -> c) -> (a -> b) -> a -> c . forall b a. [b] -> SP a b -> SP a b putsSP putSPms :: forall o i s. o -> SPms i o s () putSPms = forall k r. (k -> k) -> Msc k r toMsc forall b c a. (b -> c) -> (a -> b) -> a -> c . forall b a. b -> SP a b -> SP a b putSP getSPms :: forall i o s. SPms i o s i getSPms = forall k r s. Cont k r -> Ms k s r toMs forall a b. Cont (SP a b) a getSP nullSPms :: forall i o s. SPms i o s () nullSPms = forall (m :: * -> *) a. Monad m => a -> m a return () loadSPms :: forall i o s. SPms i o s s loadSPms = forall k s. Ms k s s loadMs storeSPms :: forall s i o. s -> SPms i o s () storeSPms = forall s k. s -> Msc k s storeMs stateMonadSP :: forall s i o ans. s -> SPms i o s ans -> (ans -> SP i o) -> SP i o stateMonadSP s s0 (Mk Cont (s -> SP i o) ans spm) ans -> SP i o sp = Cont (s -> SP i o) ans spm (\ans ans s state->ans -> SP i o sp ans ans) s s0