haskell - Monad transformers monad duplication -
i new monad transformers, sorry easy question. have value val :: maybet io string , function fn :: string -> io [string]. after binding, have val >>= liftm fn :: maybet io (io [string]). how can remove duplicate io monad , result of type maybet io [string]?
use lift (or liftio) instead of liftm.
> :t val >>= lift . fn val >>= lift . fn :: maybet io [string] liftm applying pure functions in monad. lift , liftio lifting actions transformer.
liftm :: monad m => (a -> b) -> m -> m b lift :: (monad m, monadtrans t) => m -> t m liftio :: monadio m => io -> m
Comments
Post a Comment