Open samvv opened 1 year ago
Consider the following definition:
enum List a. Nil Pair a (List a)
Here, the recursive call to List a is wrapped in a Pair, which makes everything OK.
List a
Pair
Imagine now the following type:
enum Node a. Ref (Node a)
Here, the datatype is clearly invalid because to instantiate it you would need an infinite sequence of Refs.
Ref
The compiler needs a check to prevent this from happening.
Problem
Consider the following definition:
Here, the recursive call to
List a
is wrapped in aPair
, which makes everything OK.Imagine now the following type:
Here, the datatype is clearly invalid because to instantiate it you would need an infinite sequence of
Ref
s.The compiler needs a check to prevent this from happening.