\textit{fieldselector} \rightarrow \tau$.
Note that the inference rule only checks if a field selector can be applied on
-a certain type, and does not use the field selector to infer the type. This means that a program: \tt{f(x)\{ return x.hd; \}} can not be typed, and instead
+a certain type, and does not use the field selector to infer the type. This
+means that a program: \tt{f(x)\{ return x.hd; \}} can not be typed, and instead
\tt{f} must be explicitly typed as \tt{:: [a] -> a} (or something more
specialised) by the programmer. This could be improved by
changing the \tt{apfs} function to infer for type variables.
--- /dev/null
+plus(x,y) {
+ return x + y;
+}
+main() {
+ var x = plus(3, 4);
+}
\ No newline at end of file
--- /dev/null
+//modify1(s) :: [Char] -> [Char] {
+// //s.hd = 'a';
+// s.tl = [];
+// return s;
+//}//
+
+//modify2(c) :: Char -> Void {
+// c = 'a';
+//}//
+
+//main() {
+// var zs = "bar";
+// var zc = 'b';
+// var zss = modify1(zs);
+// modify2(zc);//
+
+// print("zs was bar, is now: ");
+// print(zs);
+// print(", m1 returned: ");
+// print(zss);
+// print("\n");
+// print("zc was 'b', is now: ", zc, "\n");
+//}
+
+modi(t) :: (Int,Int) -> Void {
+ t.fst = 1;
+}
+
+main() {
+ var x = (2,3);
+ print(x.fst);
+ modi(x);
+ print(x.fst);
+}
\ No newline at end of file