monadic approach to effect systems in scala