Can someone familiar with Haskell monad transformers explain how they solve this problem or offer an alternative solution?
, . Haskell:
type EffM a s x = Either a (State s x)
, . 2 :
type TransM a s x = EitherT a (State s) x
, T , x parens. .
, State , , Either "" " ", "" , . , , - , .
, , join , Monad.
import Control.Monad.State
import Control.Monad.Trans.Either
import Control.Monad
type Eff e s a = EitherT e (State s) a
-- type the following in REPL
λ :t join
join :: Monad m => m (m a) -> m a
λ :t join :: Eff e s (Eff e s a) -> Eff e s a
join :: Eff e s (Eff e s a) -> Eff e s a
:: Eff e s (Eff e s a) -> Eff e s a
-- the slightly cryptic output above means that it typechecks correctly
, Haskell 1. , , EitherState ( StateEither - ), , join . , EitherT Elm.
1 . , /Free, , , . , .
2 Monad, , , x Monad ( Either , , ).