path uses state monad