[Haskell-cafe] Expressing "self-composable" functions at the type level
baliulia at gmail.com
Sun Nov 10 15:35:38 UTC 2013
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:
More information about the Haskell-Cafe