Ran across this in F# today:
let test<'a> (f: 'a -> unit) =
let x = f 123
let y = f "wow"
()
Which produces a compiler error, since the generic parameter must be the same within each call of test<'a> as described here: Type inference not working when passing map function
While this makes sense, it made me curious if there are any other languages out there that have implemented something like this--maybe a sort of "parameter-level generics"?
As a follow up, what are the challenges to implementing something like this?