6 May
2008
6 May
'08
12:13 a.m.
2008/5/5 Sai Hemanth K <saihemanth@gmail.com>:
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.