Added memoisation to the State<S,T> monad