In Polymorphic Algebraic Data Type Reconstruction, Tom Schrijvers and Maurice Bruynooghe create some magic: in addition to normal type declaration inference, they infer ADT definitions. From the abstract:
One of the disadvantages of statically typed languages is the programming overhead caused by writing all the necessary type information: Both type declarations and type definitions are typically
required. Traditional type inference aims at relieving the programmer from the former.
We present a rule-based constraint rewriting algorithm that reconstructs both type declarations and type definitions, allowing the programmer to effectively program type-less in a strictly typed language.
Is the algorithm guaranteed to terminate? Well...
...theoretically there must be some programs for which it does not terminate. However, as with Henglein’s algorithm, we are not aware of any actual program for which it does not terminate.
We quote Henglein to emphasize that the termination of the inference is only an issue for programs that have problematic types:
. . . why type checking is no more practical than type inference:
there are constructible ML-programs that fit on a
page and are, at least theoretically, well typed, yet writing
their principal types would require more than the number of
atoms in the universe. So writing an explicitly typed version
of the program is impossible to start with.
Recent comments
31 weeks 3 days ago
31 weeks 4 days ago
31 weeks 4 days ago
1 year 1 week ago
1 year 5 weeks ago
1 year 7 weeks ago
1 year 7 weeks ago
1 year 10 weeks ago
1 year 14 weeks ago
1 year 14 weeks ago