errors/OrphanInstance.md
OrphanInstance Errormodule A where
class SomeClass a
module B where
data SomeData
module C where
import A
import B
instance someInstance :: SomeClass SomeData
This 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.
newtype, and defining the instance in the same module as the newtype.When using type classes involving functional dependencies, the rules for orphan instances are a little more complicated. They are explained in this blog post.