Modified type checking parser state to be monadic