instance - Specifying that a type can only exist in one class if it already exists in other classes in Haskell -
i working on problem involving unification, user-defined type subst a. problem reads:
"define type class unifiable specifies function unify::a -> -> maybe (subst a) must defined type inside class. type can in unifiable class if in eq , substitutable classes, , should represented in definition."
this how have defined substitutable , unifiable far:
class substitutable subst :: subst -> -> class unifiable unify :: -> -> maybe (subst a)
however, i'm not sure how go specifying type can in unifiable class if in eq , substitutable classes.
i'm not looking answer specific problem, in general, how go specifying type can in 1 class if in other classes?
thanks.
the class definition can contain constraints, function.
class (eq a, substitutable a) => unifiable unify :: -> -> maybe (subst a)
Comments
Post a Comment