Please read Chapters 20 and 21 in your textbook.
Please do the following problems
Combine the checkers fullequirec and fullref in a single implementation that handles types such as:
Counter = Rec S . { get : S -> Nat,
set : S -> Nat -> Unit,
inc : S -> Unit };
counterClass =
lambda rep: {x: Ref Nat}.
{get = lambda s:Counter . !(rep.x),
set = lambda s:Counter . lambda n:Nat . (rep.x) := n,
inc = lambda s:Counter . (s.set) s (succ ((s.get) s))}
as Counter;
makeCounter =
lambda i:nat . counterClass {x = (ref i)};
Put this combined code in a subdirectory fullequirecref
in your homework10 folder.
Can you typecheck your answer to Question 4.3 of Homework #9 (object.f) now that you have recursive types? (Of course, you will need to fix/specify the types.) Why or why not? What happens?