
10 Nov
2013
10 Nov
'13
10:35 a.m.
Hi, On 11/10/2013 03:18 AM, Dan Doel wrote:
Doing significantly better is harder, and I don't think you'll ever get to the real type you want, which is:
twice : ((a -> b) ∩ (b -> c)) -> a -> c
I.E. look up interstection types if you're into this stuff. They tend to be less popular than quantifier-based polymorphism, though.
I think the problem is that having intersection types implies subtyping, and subtyping is obviously troublesome. Essentially the same problem [as mine] is discussed in an old thread, where a partial ("value-level") solution is proposed via typeclass hackery: http://www.haskell.org/pipermail/haskell-cafe/2006-January/013868.html -- Ignas