{- ------------------------------
   let/lambda
   ------------------------------ -}

-- for both let and lambda, we need to make sure we restore the
-- state after parsing the body, so that the lexical binding doesn't leak
parseAbs = do reserved "lambda"
              ctx <- getState
              (TmBind var (VarBind ty)) <- parseVarBind
              symbol "."
              body <- parseTerm
              setState ctx
              return $ TmAbs var ty body
parseAbs = do reserved "lambda"
              ctx <- getState
              (TmBind var (VarBind ty)) <- parseVarBind
              symbol "."
              body <- parseTerm
              setState ctx
              return $ TmAbs var ty body
parseAbs = do reserved "lambda"
              ctx <- getState
              (TmBind var (VarBind ty)) <- parseVarBind
              symbol "."
              body <- parseTerm
              setState ctx
              return $ TmAbs var ty body