
5 May
2008
5 May
'08
12:13 p.m.
2008/5/5 Sai Hemanth K
Hi,
I declared a multi param type class as below: class MyString m c where zIndex :: m -> Int -> c zLength :: m -> Int zPack :: [c] -> m zEquals :: c ->c -> Bool zWrap :: [c] -> (m,AnExistingDataType)
I infer from your questions that you probably missed setting a functional dependency, that is
class MyString m c | m -> c where zIndex :: m -> Int -> c zLength :: m -> Int zPack :: [c] -> m zEquals :: c ->c -> Bool zWrap :: [c] -> (m,AnExistingDataType)
which means, "c is univocaly determined by m". You'll need -XFunctionalDependencies to make it work in GHC.