horde-ad icon indicating copy to clipboard operation
horde-ad copied to clipboard

How can we reduce type parameters further?

Open tomjaguarpaw opened this issue 2 years ago • 4 comments

I think we need @goldfirere to help with this.

To simplify the surface API we'd like to reduce the length number of type parameters floating around. Currently we have two (typically named s and dual). We'd like to reduce it to one. In principle this is easy: put the two into a type-level pair! In practice this doesn't work, and I don't know why.

Have a look at 7ba5614. I package s and dual into '(s, dual) and implement type families to take them out again. This seems to do the trick except I also need the constraint s_dual ~ '(s, dual). It seems that the type checker doesn't know that every type of kind (A, B) is of the form '(s, dual). Perhaps it is correct! After all, stuck type families don't have that form.

@goldfirere Is there some ergonomic trick we can apply to force the type checker to "pattern match" on s_dual?

tomjaguarpaw avatar May 09 '22 10:05 tomjaguarpaw