THE FOLD / SPAWN / GENESIS BLOCK / THE TYPE INFERENCE
THE TYPE INFERENCE
it removes an opportunity to be wrong
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
You do not write the types. They were already determined by what the code does with its arguments, and a compiler can read them off without being told anything.
LIT verified live — a real Hindley-Milner core running in this page. 8 programs, 0 annotations written, 0 type errors. The identity function comes out as (t1 -> t1). Compose comes out as ((t10 -> t11) -> ((t9 -> t10) -> (t9 -> t11))), which nobody stated anywhere — it is the only type the applications permit.
LIT verified live — a real Hindley-Milner core running in this page. 8 programs, 0 annotations written, 0 type errors. The identity function comes out as (t1 -> t1). Compose comes out as ((t10 -> t11) -> ((t9 -> t10) -> (t9 -> t11))), which nobody stated anywhere — it is the only type the applications permit.
2 HOW IT WAS WEAVED · AI + HUMAN
Algorithm W is Milner’s (1978), building on Hindley; the whole method is generate constraints, then solve them by unification.
AVAN (AI) implemented the inferencer rather than describing it, so the types on this page are produced by the page. THE UNIFICATION, THE OCCURS CHECK and THE LET POLYMORPHISM next door all run against this same core — four spheres, one implementation, so none of them can quietly disagree with the others.
AVAN (AI) implemented the inferencer rather than describing it, so the types on this page are produced by the page. THE UNIFICATION, THE OCCURS CHECK and THE LET POLYMORPHISM next door all run against this same core — four spheres, one implementation, so none of them can quietly disagree with the others.
3 ONE DIMENSION
Eight programs, no annotations, the types read off.
4 TWO DIMENSIONS · INTERACTIVE
Step through and watch the constraint solved.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: a shape implied, not stated.
AVAN’s addition (the inverse-companion): the forward reading is that inference frees you from writing types. The inverse is that it frees you from writing them and not from having them. Every one of those 8 programs has exactly one most general type whether anyone writes it or not; the annotation was never the type, only a claim about it. Read backwards, inference does not remove a burden — it removes an opportunity to be wrong, and the price is that the error surfaces wherever the constraint finally fails rather than where you would have written the lie.
LIT a real Hindley-Milner core running in the page infers 8 programs with 0 annotations written and 0 type errors, giving the identity as (t1 -> t1) and compose as ((t10 -> t11) -> ((t9 -> t10) -> (t9 -> t11))), which nobody stated anywhere - it is the only type the applications permit
FIG Algorithm W is Milner's (1978), building on Hindley; the method is generate constraints then solve them by unification. AVAN implemented the inferencer rather than describing it, so the types on this page are produced by the page. THE UNIFICATION, THE OCCURS CHECK and THE LET POLYMORPHISM next door run against this same core - four spheres, one implementation, so none of them can quietly disagree with the others.
FIG Algorithm W is Milner's (1978), building on Hindley; the method is generate constraints then solve them by unification. AVAN implemented the inferencer rather than describing it, so the types on this page are produced by the page. THE UNIFICATION, THE OCCURS CHECK and THE LET POLYMORPHISM next door run against this same core - four spheres, one implementation, so none of them can quietly disagree with the others.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of GENESIS BLOCK · David Lee Wise (ROOT0), with AVAN