You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=NotAFunctionType (Int, Int, String) -- this type should be a function but it is not
26
-
| FunctionNotInScopeString (Int, Int, String) -- this variable denotes a function which is not in scope at the point where it is used
27
-
| TypeMismatchTypeType (Int, Int, String) -- this type does not match the type expected at the point where it was declared
28
-
| NotAProductTypeType (Int, Int, String) -- this type should be a product type but it is not
29
-
| DuplicatedLinearVariableString (Int, Int, String) -- this linear variable is used more than once
30
-
| NotALinearFunctionString (Int, Int, String) -- this function is used more than once despite not being declared linear
31
-
| NotALinearTermTermType (Int, Int, String) -- this term should be linear but is is not
32
-
| NoCommonSupertypeTypeType (Int, Int, String) -- these two types have no common supertype
26
+
=NotAFunctionType (Int, Int, String) -- this type should be a function but it is not
27
+
| FunctionNotInScopeString (Int, Int, String) -- this variable denotes a function which is not in scope at the point where it is used
28
+
| TypeMismatchFunTypeType (Int, Int, String) -- this type does not match the type expected at the point where it was declared
29
+
| TypeMismatchIfElseTermTermTypeType (Int, Int, String) -- this type does not match the type expected at the point where it was declared
30
+
| TypeMismatchApplyTermTermTypeType (Int, Int, String) -- this type does not match the type expected at the point where it was declared
31
+
| NotAProductTypeType (Int, Int, String) -- this type should be a product type but it is not
32
+
| DuplicatedLinearVariableString (Int, Int, String) -- this linear variable is used more than once
33
+
| NotALinearFunctionString (Int, Int, String) -- this function is used more than once despite not being declared linear
34
+
| NotALinearTermTermType (Int, Int, String) -- this term should be linear but is is not
35
+
| NoCommonSupertypeTypeType (Int, Int, String) -- these two types have no common supertype
33
36
deriving (Eq, Ord, Read)
34
37
35
-
instanceShowTypeErrorwhere
38
+
instanceShowTypeErrorwhere
36
39
show::TypeError->String
37
-
show (NotAFunction typ (line, _, fname)) ="The inferred type: '"++show typ ++"' of the top level function named: '"++ fname ++"' defined at line: "++show line ++" should be a function type but it is not"
40
+
41
+
show (NotAFunction typ (line, _, fname)) = format "The inferred type: '{0}' of the top level function named: '{1}' defined at line: {2} should be a function type but it is not" [show typ, fname, show line]
38
42
39
-
show (FunctionNotInScope var (line, _, fname)) ="The variable named '"++ var ++"' in the top level function named: '"++ fname ++"' defined at line: "
40
-
++show line ++" denotes a function which is not in scope"
43
+
show (FunctionNotInScope var (line, _, fname)) = format "The variable named '{0}' in the top level function named: '{1}' defined at line: {2} denotes a function which is not in scope" [var, fname, show line]
44
+
45
+
show (TypeMismatchFun type1 type2 (line, _, fname)) = format "The expected type '{0}' of the top level function named: '{1}' defined at line: {2} cannot be matched with actual type: '{3}'" [show type1, fname, show line, show type2]
46
+
47
+
show (TypeMismatchIfElse term1 term2 type1 type2 (line, _, fname)) = format "The expected type '{0}' of the top level function named: '{1}' defined at line: {2} cannot be matched with actual type: '{3}'" [show type1, fname, show line, show type2]
41
48
42
-
show (TypeMismatchtype1 type2 (line, _, fname)) ="The expected type '"++show type1 ++"' of the top level function named: '"++ fname ++"' defined at line: "++show line ++"cannot be matched with actual type: '"++showtype2 ++"'"
49
+
show (TypeMismatchApply term1 term2 type1 type2 (line, _, fname)) =format "The expected type '{0}' of the top level function named: '{1}' defined at line: {2} cannot be matched with actual type: '{3}'" [show type1, fname, showline, show type2]
43
50
44
-
show (NotAProductType typ (line, _, fname)) ="The type '"++show typ ++"' in the top level function named: '"++ fname ++"' defined at line: "
45
-
++show line ++" is not a product type"
51
+
show (NotAProductType typ (line, _, fname)) = format "The type '{0}' in the top level function named: '{1}' defined at line: {2} is not a product type" [show typ, fname, show line]
46
52
47
-
show (DuplicatedLinearVariable var (line, _, fname)) ="The linear variable '"++ var ++"' in the top level function named: '"++ fname ++"' defined at line: "++show line ++"is used more than once"
53
+
show (DuplicatedLinearVariable var (line, _, fname)) =format "The linear variable '{0}' in the top level function named: '{1}' defined at line: {2} is used more than once" [var, fname, show line]
48
54
49
-
show (NotALinearFunction fun (line, _, fname)) ="The function named: '"++ fun ++"' which is used in the top level function named: '"++ fname
50
-
++"' defined at line: "++show line ++" is used more than once despite not being declared linear"
55
+
show (NotALinearFunction fun (line, _, fname)) = format "The function named: '{0}' which is used in the top level function named: '{1}' defined at line: {2} is used more than once despite not being declared linear" [fun, fname, show line]
51
56
52
-
show (NotALinearTerm term typ (line, _, fname)) ="Term: '"++show term ++"' having as type: "++show typ
53
-
++" which occurs in function "++ fname ++" defined at line: "++show line ++" is not linear"
57
+
show (NotALinearTerm term typ (line, _, fname)) = format "Term: '{0}' having as type: {1} which occurs in function {2} defined at line: {3} is not linear" [show term, show typ, fname, show line]
54
58
55
-
show (NoCommonSupertype type1 type2 (line, _, fname)) ="Could not find a common super-type for types '"
56
-
++show type1 ++" and '"++show type2 ++"' expected by top level function '"++ fname ++"' defined at line: "++show line ++"."
59
+
show (NoCommonSupertype type1 type2 (line, _, fname)) = format "Could not find a common super-type for types '{0}' and '{1}' expected by top level function '{2}' defined at line: {3}." [show type1, show type2, fname, show line]
0 commit comments