September 2017
Beginner to intermediate
396 pages
9h 46m
English
stack new state-monad-trans simple
import Data.Functor import Control.Applicative import Control.Monad
newtype StateT s m a = StateT { runStateT :: s -> m (a, s) }
instance Functor m => Functor (StateT s m) where fmap f (StateT func) = let stateFunc s = (\(xa,xs) -> (f xa, xs)) <$> func s in StateT stateFunc
Read now
Unlock full access