Bidirectional Instance Contexts

Just a quick one today, but I wanted to point out a little trick you can do with Haskell’s typeclass inference. Imagine we have some little class, the details of which matter not in the least: type Foo :: Type -> Constraint class Foo a where ... We can give some instances of this type: instance Foo Int where ... instance Foo Bool where ... instance Foo () where ... Regular, everyday stuff. But the…