I want to write a Convertible instance for a Haskell type to its C representation
It looks like this:
instance Convertible Variable (IO (Ptr ())) where
Now GHC complains:
Illegal instance declaration for `Convertible
Variable (IO (Ptr ()))'
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
Use -XFlexibleInstances if you want to disable this.)
In the instance declaration for `Convertible Variable (IO (Ptr ()))'
I thought Flexible Instances were needed if you had free types in your instance declaration, but this is not the case. I can get it to compile when adding the right pragma, but can anyone explain why I need this?
()
norPtr ()
norIO (Ptr ())
are type variables – IngoFlexibleInstances
is one of the most harmless language extensions that exist. Just enable it. – kosmikusTypeFamilies
on the same level as utter trivialities such asEmptyDataDecls
. Both might be good extensions, but if you're concerned about bitrot and stability, that's unfortunately not the only concern. – kosmikus