|
|
|
|
|
by kvb
3388 days ago
|
|
Though note that an even better type would probably be twice : forall a,b,c. ((a->b)&(b->c)) -> a -> c
(e.g. in MLSub, the type for twice (fun x -> x::[]) 1
is the unsatisfying (rec a = (a list | int) list)
rather than the expected (int list) list
)
|
|
[1] https://github.com/tomprimozic/type-systems/tree/master/firs...
Edit: although on second thought, just first-class polymorphism isn't enough to fix this... any type system where the function `twice` has the same type as the function `three_times` will exhibit the same problem!