@@ -12,6 +12,9 @@ class Constant:
1212 def __str__ (self ) -> str :
1313 return str (self .name )
1414
15+ def __repr__ (self ) -> str :
16+ return f"parse_term('{ self } ')"
17+
1518
1619@dataclass (frozen = True )
1720class Variable :
@@ -20,6 +23,9 @@ class Variable:
2023 def __str__ (self ) -> str :
2124 return str (self .identifier )
2225
26+ def __repr__ (self ) -> str :
27+ return f"parse_term('{ self } ')"
28+
2329
2430@dataclass (frozen = True )
2531class UntypedApplication :
@@ -29,6 +35,9 @@ class UntypedApplication:
2935 def __str__ (self ) -> str :
3036 return f'({ self .left } { self .right } )'
3137
38+ def __repr__ (self ) -> str :
39+ return f"parse_term('{ self } ')"
40+
3241
3342@dataclass (frozen = True )
3443class TypedApplication :
@@ -38,6 +47,9 @@ class TypedApplication:
3847 def __str__ (self ) -> str :
3948 return f'({ self .left } { self .right } )'
4049
50+ def __repr__ (self ) -> str :
51+ return f"parse_term('{ self } ')"
52+
4153
4254@dataclass (frozen = True )
4355class UntypedAbstraction :
@@ -47,6 +59,9 @@ class UntypedAbstraction:
4759 def __str__ (self ) -> str :
4860 return f'({ BinderSymbol .LAMBDA } { self .var } .{ self .body } )'
4961
62+ def __repr__ (self ) -> str :
63+ return f"parse_term('{ self } ')"
64+
5065
5166@dataclass (frozen = True )
5267class TypedAbstraction :
@@ -57,6 +72,9 @@ class TypedAbstraction:
5772 def __str__ (self ) -> str :
5873 return f'({ BinderSymbol .LAMBDA } { self .var } :{ self .var_type } .{ self .body } )'
5974
75+ def __repr__ (self ) -> str :
76+ return f"parse_term('{ self } ')"
77+
6078
6179UntypedTerm = Constant | Variable | UntypedApplication | UntypedAbstraction
6280TypedTerm = Constant | Variable | TypedApplication | TypedAbstraction
0 commit comments