rwsmonad Read write state monad derivation exercise Inspiration The series of blog posts: Deriving the state monad from first principles Deriving the reader monad from first principles Deriving the writer monad from first principles by William Yao.