Allow "instances" for non-typeclass constraints in signature files
contiguous library defines a typeclass for primitive arrays, with an associated constraint:
type Contiguous :: ( Type -> Type ) -> Constraint class Contiguous arr where type Element arr :: Type -> Constraint -- ... array methods
Now, with backpack one might want to declare:
- an array type that is an instance of
- a key type which is an allowed element of the array.
data Key data Array k instance Contiguous Array instance Element Array Key
This currently isn't allowed:
* Illegal instance for a associated type family A class instance must be for a class * In the instance declaration for `Element Array Key' | | instance Element Array Key | ^^^^^^^^^^^^^^^^^
However I think it would make sense to allow this; I don't think there's any other available mechanism to specify that any instantiation of
Array should satisfy the additional constraint
Element Array Key. Of course it's not strictly an instance (as
Element is not a typeclass, but a constraint synonym), but the alternative would be to invent backpack-specific syntax.