Add state monad for sql str processing