generated at
Orphan Instances
孤立した「型クラスのinstance宣言」のこと
classを定義したModuleと、data型を定義したModuleの両方の外部で定義されたinstanceのこと
「Orphan」の直訳は「孤児」

pursならerror
hsではwarning

以下のように定義した場合、 showHoge はOrphan Instancesとなる
↓はpursのコードなので、↓はerrorになるmrsekut
Class.purs(hs)
-- classの定義 module Class where class MyShow a where myShow :: a -> String
data.purs(hs)
-- data型の定義 module Data where data Hoge = Hoge
orphan.purs(hs)
-- instanceの定義 module Orphan where instance showHoge :: MyShow Hoge where myShow _ = "hoge"
instance showHoge .. の記述を、 Class Data のいずれかに移せばOrphan Instanceではなくなり、errorは解消される




参考
pursのdocs