Refactored the MonadGenerator type class.