[Haskell-cafe] Merging classes

pat browne Patrick.Browne at comp.dit.ie
Fri Oct 16 12:58:04 EDT 2009

Following on from my earlier *Merging modules* email, where I tried to
simulate ontology merging with Haskell modules;


I *think* that the type of merging that I am attempting is difficult
with modules so I gave classes a try. I did not get very far (see
below). Perhaps I need a combination of type classes and modules.
In fairness this is more of a specification task than a programming task
and perhaps I am barking up the wrong tree.
Any help appreciated.


attempting an ontology merge with type classes
For specification of requirement see
-- Data types for COMMON
data  Woman = WomanC
data Person  = PersonC

-- Additional data type for ONTOLOGY1
data Bank = BankC

-- Additional data type for ONTOLOGY2
-- but how do I let type Bank have the same name in both classes and
-- still be distinct (homonyms) in the merged class
--   data Bank = BankC

class  COMMON a b where
class  (COMMON a b) => ONTOLOGY1 a b where
class  (COMMON a b) => ONTOLOGY2 a b where
class  (ONTOLOGY1 a b, ONTOLOGY2 a b) => MERGEDONTOLOGY a b where

-- not really sure how to proceed from here
instance COMMON Woman Person where

More information about the Haskell-Cafe mailing list