Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
module Flite.State where
import Control.Monad (liftM, ap)
import Control.Applicative (Applicative(..))
newtype State s a = S { runState :: s -> (s, a) }
instance Monad (State s) where
m >>= f = S (\s -> case runState m s of
(s', a) -> runState (f a) s')
instance Functor (State s) where
fmap = liftM
instance Applicative (State s) where
pure a = S (\s -> (s, a))
(<*>) = ap
1753a4cb4This file is pinned to the selected release. Download the original to open it in your design tool.