You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
, bar :: Int<br />
} deriving (Show)<br />
computation :: Reader MyContext (Maybe String)<br />
computation = do<br />
n w -> <strong>Write</strong>r w ()<br />
e monad can be evaluated returning the collected writer context and optionally the returned value.<br />
exec<strong>Write</strong>r :: (Monoid w) => <strong>Write</strong>r w a -> w<br />
run<strong>Write</strong>r :: (Monoid w) => <strong>Write</strong>r w a -> (a, w)<br />
import Control.Monad.<strong>Write</strong>r<br />
type My<strong>Write</strong>r = <strong>Write</strong>r [Int] String<br />
example :: My<strong>Write</strong>r<br />
example = do<br />
tell [1..5]<br />
tell [5..10]<br />
return ”foo”<br />
output :: (String, [Int])<br />
output = run<strong>Write</strong>r example<br />
ExceptT<br />
e Exception monad allows logic to fail at any point during computation with a user-defined exception.<br />
e exception type is the first parameter of the monad type.<br />
27