{-# LANGUAGE CPP #-} #include "containers.h" {-# OPTIONS_HADDOCK hide #-}-- | A clone of Control.Monad.State.Strict.moduleUtils.Containers.Internal.StatewhereimportControl.Monad(ap,liftM2)importControl.Applicative(liftA)importUtils.Containers.Internal.Prelude importPrelude()newtypeState s a =State {forall s a. State s a -> s -> (s, a) runState ::s ->(s ,a )}instanceFunctor(State s )wherefmap :: forall a b. (a -> b) -> State s a -> State s b fmap=(a -> b) -> State s a -> State s b forall (f :: * -> *) a b. Applicative f => (a -> b) -> f a -> f b liftAinstanceMonad(State s )where{-# INLINE(>>=)#-}State s a m >>= :: forall a b. State s a -> (a -> State s b) -> State s b >>=a -> State s b k =(s -> (s, b)) -> State s b forall s a. (s -> (s, a)) -> State s a State ((s -> (s, b)) -> State s b) -> (s -> (s, b)) -> State s b forall a b. (a -> b) -> a -> b $\s s ->caseState s a -> s -> (s, a) forall s a. State s a -> s -> (s, a) runState State s a m s s of(s s' ,a x )->State s b -> s -> (s, b) forall s a. State s a -> s -> (s, a) runState (a -> State s b k a x )s s' instanceApplicative(State s )where{-# INLINEpure#-}pure :: forall a. a -> State s a purea x =(s -> (s, a)) -> State s a forall s a. (s -> (s, a)) -> State s a State ((s -> (s, a)) -> State s a) -> (s -> (s, a)) -> State s a forall a b. (a -> b) -> a -> b $\s s ->(s s ,a x )<*> :: forall a b. State s (a -> b) -> State s a -> State s b (<*>)=State s (a -> b) -> State s a -> State s b forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b apState s a m *> :: forall a b. State s a -> State s b -> State s b *>State s b n =(s -> (s, b)) -> State s b forall s a. (s -> (s, a)) -> State s a State ((s -> (s, b)) -> State s b) -> (s -> (s, b)) -> State s b forall a b. (a -> b) -> a -> b $\s s ->caseState s a -> s -> (s, a) forall s a. State s a -> s -> (s, a) runState State s a m s s of(s s' ,a _)->State s b -> s -> (s, b) forall s a. State s a -> s -> (s, a) runState State s b n s s' liftA2 :: forall a b c. (a -> b -> c) -> State s a -> State s b -> State s c liftA2 =(a -> b -> c) -> State s a -> State s b -> State s c forall (m :: * -> *) a1 a2 r. Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r liftM2execState ::State s a ->s ->a execState :: forall s a. State s a -> s -> a execState State s a m s x =(s, a) -> a forall a b. (a, b) -> b snd(State s a -> s -> (s, a) forall s a. State s a -> s -> (s, a) runState State s a m s x )