[PL-sem-jr] Monad exercises
Hugo Musso Gualandi
hgualandi at inf.puc-rio.br
Wed Nov 21 18:31:02 EST 2018
Hi everyone,
I prepared two exercises for playing with Monads, highlighting the
State and the Maybe monads. I lifted them from the Wadler paper that
we floated around earlier.
The files can be downloaded from my website (my previous attempt to
attach them to this email hit a paranoid the antivirus filter):
http://www.inf.puc-rio.br/~hgualandi/stuff/pljr-monad-problems.tar.gz
The task for the exercizes is to fill in the "undefined" blanks in the
example files I provided and to get the code to work. There are three
files:
m01_direct: Try to implement the functions with straightforward Haskell
code.
m02_monadic: This time, implement the monadic "bind" and "return"
functions and reimplement the evaluators using them.
m03_donotation: This one adds the necessary boilerplate to the code
from the previous exercise, so it can be hooked up with the actual
Monad typeclass and so you can use do-notation with it. I found that it
got a bit clunky, so I consider it "extra credit".
I tried to keep these short but please let me know if you need anything
else.
-- Hugo
More information about the Pl-sem-jr
mailing list