ghc-9.13: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Utils.Monad.State.Strict

Description

A state monad which is strict in its state.

Synopsis

The State monad

newtype State s a Source #

A state monad which is strict in the state s, but lazy in the value a.

See Note [Strict State monad] for the particular notion of strictness and implementation details.

Constructors

State' (s -> (# a, s #)) 

Bundled Patterns

pattern State :: (s -> (# a, s #)) -> State s a 

Instances

Instances details
Applicative (State s) Source # 
Instance details

Defined in GHC.Utils.Monad.State.Strict

Methods

pure :: a -> State s a #

(<*>) :: State s (a -> b) -> State s a -> State s b #

liftA2 :: (a -> b -> c) -> State s a -> State s b -> State s c #

(*>) :: State s a -> State s b -> State s b #

(<*) :: State s a -> State s b -> State s a #

Functor (State s) Source # 
Instance details

Defined in GHC.Utils.Monad.State.Strict

Methods

fmap :: (a -> b) -> State s a -> State s b #

(<$) :: a -> State s b -> State s a #

Monad (State s) Source # 
Instance details

Defined in GHC.Utils.Monad.State.Strict

Methods

(>>=) :: State s a -> (a -> State s b) -> State s b #

(>>) :: State s a -> State s b -> State s b #

return :: a -> State s a #

state :: (s -> (a, s)) -> State s a Source #

evalState :: State s a -> s -> a Source #

execState :: State s a -> s -> s Source #

runState :: State s a -> s -> (a, s) Source #

Operations

get :: State s s Source #

gets :: (s -> a) -> State s a Source #

put :: s -> State s () Source #

modify :: (s -> s) -> State s () Source #