77
88import javax .swing .LookAndFeel ;
99
10+ import typesystem .HaskellType ;
11+
1012public class HaskellTypeParser {
1113
1214 private HashMap <String , ArrayList <String >> associatedTypeClasses ;
1315 // (Eq a, Ord a, Eq t) => will become [<a,[Eq, Ord]>, <t,[Eq]>]
1416 private ArrayList <String > arguments ;
15- private String returnType ;
16- private String displayingExprType ;
17+ private HaskellType returnType ;
18+ private HaskellType displayingExprType ;
1719
1820 /**
1921 * @return the associatedTypeClasses
@@ -32,14 +34,14 @@ public ArrayList<String> getArguments() {
3234 /**
3335 * @return the returnType
3436 */
35- public String getReturnType () {
37+ public HaskellType getReturnType () {
3638 return returnType ;
3739 }
3840
3941 /**
4042 * @return the displayingExprType
4143 */
42- public String getDisplayingExprType () {
44+ public HaskellType getDisplayingExprType () {
4345 return displayingExprType ;
4446 }
4547
@@ -93,7 +95,7 @@ public boolean parseType(){
9395 equalArrowIndex = doubleColonIndex ;
9496 }
9597 parseArguments (type .substring (equalArrowIndex + 2 ).trim ());
96- this .displayingExprType = type .substring (doubleColonIndex + 2 ).trim ();
98+ this .displayingExprType = new HaskellType ( type .substring (doubleColonIndex + 2 ).trim () );
9799 return true ;
98100 }
99101
@@ -104,7 +106,7 @@ private void parseArguments(String argStr) {
104106 String arg = arguments [i ];
105107 this .arguments .add (arg );
106108 }
107- this .returnType = arguments [arguments .length - 1 ];
109+ this .returnType = new HaskellType ( arguments [arguments .length - 1 ]) ;
108110
109111 }
110112
0 commit comments