Anti-Instances in Haskell

13 Likes

Thanks for the write-up.

Should new code stop using TypeError, in favour of the new Unsatisfiable?

3 Likes

Yes, Unsatisfiable has more predictable behaviour apparently. Now, it’s only warm out of the oven, let’s see how it reacts to people’s usecases.

1 Like

Also keep in mind that if you need to support GHC versions before 9.8.1, you need to stick with TypeError, or, assuming you’re OK with that, make a dirty compatibility shim with CPP.

3 Likes

I suspect a compatibility shim will be quite hard because Unsatisfiable was introduced due to ergonomics problems with TypeError. I can’t imagine it’s possible to extract any better behaviour from the intersection of the features than from TypeError itself.

1 Like

Btw. is there any estimate when may the deprecated instances proposal land to GHC?

1 Like

The linked issue was closed 4 days ago, so I think it will be in 9.10. That might take another 6-10 months perhaps?

1 Like

Years ago, I wrote ban-instance. Should I update it to use Unsatisfiable?

1 Like

That might be a case where a shim would work well. You could use Unsatisfiable on GHC >= 9.8, and therefore stub out the type class methods in a way that doesn’t work for TypeError.

1 Like

Probably yes, for the >=9.8 range

2 Likes

According to GHC status, GHC 9.10 is currently scheduled for late March 2024.

3 Likes