protocol based monad library