On 2/18/06, asker <[EMAIL PROTECTED]> wrote: > > Hi, > > I'm trying to make three haskell classes and an instance this way: > ------------------------------------------------------------------------------ > class (Eq a) => Graph a where > vert :: [a] > ady :: a -> [a] > > class (Graph a) => Paths a where > gps :: a -> a -> [[a]] > > class (Paths a) => Minimum a where > mgps :: a -> a -> [a] > > instance Minimum Char where > vert = ['a' .. 'f'] -- This is the line of the error message. > ady 'a' = ['b', 'c'] > ady 'b' = ['d', 'c', 'e'] > ady 'd' = ['f'] > gps = bepgr -- bepgr is defined and implemented in other code's part > mgps = head gps > ------------------------------------------------------------------------------ > > > > > When I try to run this I get: "ERROR: filepath:line -No member vert in class > "Minimum"" I don't know why does this happen, am I doing something wrong? >
The class Minimum doesn't have a member 'vert', Graph does, though. You need to instantiate your data type in all three classes separately. So three separate "instance" declarations, one for each class. -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862 _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
