A Hugo incarnation of the blog.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

error.hpp 483B

123456789101112131415161718192021
  1. #pragma once
  2. #include <exception>
  3. #include "type.hpp"
  4. struct type_error : std::exception {
  5. std::string description;
  6. type_error(std::string d)
  7. : description(std::move(d)) {}
  8. const char* what() const noexcept override;
  9. };
  10. struct unification_error : public type_error {
  11. type_ptr left;
  12. type_ptr right;
  13. unification_error(type_ptr l, type_ptr r)
  14. : left(std::move(l)), right(std::move(r)),
  15. type_error("failed to unify types") {}
  16. };