Project Euler 15, Lattice Paths

Function pathsm is the function which run a monad for memoization. (caches inputs of parameters to avoid repetition of expensive computation.) Since memoization is in itself a sideeffect, can be done with a monad.