Add 'internal' types.
This commit is contained in:
14
13/type.hpp
14
13/type.hpp
@@ -13,7 +13,6 @@ struct type {
|
||||
virtual ~type() = default;
|
||||
|
||||
virtual void print(const type_mgr& mgr, std::ostream& to) const = 0;
|
||||
virtual bool is_arrow(const type_mgr& mgr) const;
|
||||
};
|
||||
|
||||
using type_ptr = std::shared_ptr<type>;
|
||||
@@ -37,7 +36,6 @@ struct type_var : public type {
|
||||
: name(std::move(n)) {}
|
||||
|
||||
void print(const type_mgr& mgr, std::ostream& to) const;
|
||||
bool is_arrow(const type_mgr& mgr) const;
|
||||
};
|
||||
|
||||
struct type_base : public type {
|
||||
@@ -48,6 +46,17 @@ struct type_base : public type {
|
||||
: name(std::move(n)), arity(a) {}
|
||||
|
||||
void print(const type_mgr& mgr, std::ostream& to) const;
|
||||
|
||||
virtual bool is_internal() const { return false; }
|
||||
};
|
||||
|
||||
struct type_internal : public type_base {
|
||||
type_internal(std::string n, int32_t a = 0)
|
||||
: type_base(std::move(n), a) {}
|
||||
|
||||
void print(const type_mgr& mgr, std::ostream& to) const;
|
||||
|
||||
bool is_internal() const { return true; }
|
||||
};
|
||||
|
||||
struct type_data : public type_base {
|
||||
@@ -69,7 +78,6 @@ struct type_arr : public type {
|
||||
: left(std::move(l)), right(std::move(r)) {}
|
||||
|
||||
void print(const type_mgr& mgr, std::ostream& to) const;
|
||||
bool is_arrow(const type_mgr& mgr) const;
|
||||
};
|
||||
|
||||
struct type_app : public type {
|
||||
|
||||
Reference in New Issue
Block a user