module A where
class SomeClass amodule B where
data SomeDatamodule C where
import A
import B
instance someInstance :: SomeClass SomeDataThis error occurs when an instance is declared outside of the module that declares the class it is for, and also none of the instance's types are declared in the same module.
Above, someInstance is an orphan here as it is defined in a module separate from both SomeData and SomeClass.
- If possible, move the instance into an allowed module.
- Consider adding a
newtype, and defining the instance in the same module as thenewtype.
When using type classes involving functional dependencies, the rules for orphan instances are a little more complicated. They are explained in this blog post.
