Make function type rendering prettier

This commit is contained in:
Emi Simpson 2023-03-09 22:33:34 -05:00
parent 97cd81dc43
commit d94ff158f7
Signed by: Emi
GPG key ID: A12F2C2FFDC3D847

View file

@ -65,7 +65,11 @@ class FunctionTy:
return self.arg_type.free_vars() | self.ret_type.free_vars() return self.arg_type.free_vars() | self.ret_type.free_vars()
def __repr__(self) -> str: def __repr__(self) -> str:
return f'({self.arg_type}) -> {self.ret_type}' arg = repr(self.arg_type)
if ' ' in arg:
return f'({arg}) -> {self.ret_type}'
else:
return f'{arg} -> {self.ret_type}'
@dataclass(frozen=True) @dataclass(frozen=True)
class HoleTy: class HoleTy: