3 ms·
It's quite easy to get extremely slow type inference in expressive typing systems. This code let f0 = fun x -> ( x, x ) in let f1 = fun y -> f0( f0 y ) in let
by mafribe 12y ago
It's quite easy to get extremely slow type inference in expressive typing systems. This code
let f0 = fun x -> ( x, x ) in
let f1 = fun y -> f0( f0 y ) in
let f2 = fun y -> f1( f1 y ) in
let f3 = fun y -> f2( f2 y ) in
let f4 = fun y -> f3( f3 y ) in
let f5 = fun y -> f4( f4 y ) in
f5 ( fun z -> z );;
took at least 3 months (!) to type-infer when I ran it on my 2008 MacBook using the standard Ocaml compiler. I have not tried since. Type inference algorithms have horrendous worst-case complexity. Fortunately that worst-case complexity usually doesn't matter in practise.