Closed Lupus closed 4 years ago
Types, type classes and type functions are just like normal functions, in that the order does matter. Thus we sadly do end up with annoying cases where type classes mandate that parameters appear in a specific order.
I'm afraid there's not really an optimal solution here, aside from "just swap them" (which is what we do for the either type). If we had type lambdas, you could have some type-level equivalent of "flip", but that would add a lot of complexity to the type system, and I'm not sure that's a route we want to go down yet.
I'm trying to create Result type, but I can't make it instance of functor. Here's my code:
Type checker is not happy about that unless I swap type parameters (i.e. write
t 'b 'a
):I really want to have type for Ok to be the first one, it makes more sense this way.
I'm using 0.7.0.0 (bbe61c6680).