servant icon indicating copy to clipboard operation
servant copied to clipboard

Remove overlapping instance `HasServer (Verb … (Headers x a)) …`

Open gdeest opened this issue 3 years ago • 3 comments

It is possible to apply a bit of elbow grease to remove some of the overlapping instances in the codebase. Those instances often go in the way of refactoring, and sometimes creep up to the user in confusing messages, so it would be helpful to get rid of them.

The main challenge is backward-compatibility: we want to avoid breaking our users code, so we cannot change the API.

This PR experiments with an approach to do so, using a closed type-family definition. Closed type family instances are ordered, which lets us work around the need for overlapping instances.

gdeest avatar Feb 22 '22 11:02 gdeest

@gdeest what's the state of this PR? Shall we wait for 0.21.0.0 or is it ok for 0.20.3.0?

tchoutri avatar Mar 05 '25 21:03 tchoutri

@tchoutri I had completely forgotten about that PR ... :-) I'd say it is urgent to wait and experiment a bit more with the approach before moving forward.

I do remember overlapping instances in servant being a hindrance to many of my type-level endeavors, though, so it is probably worth considering.

gdeest avatar Mar 06 '25 15:03 gdeest

@gdeest perfect, I'd be more than happy to pair with you on it in order to fully understand the approach. :)

tchoutri avatar Mar 06 '25 23:03 tchoutri