Let's say I have following data structure:
data Dezi = Dezi1 Int | Dezi2 String | Dezi3 [Dezi] deriving(Show)
class TestInterface a where
testInt :: a -> Dezi
instance TestInterface Int where
testInt 0 = Dezi1 0
testInt _ = Dezi2 "Nie nula"
instance Dezi a => TestInterface [a] where
testInt xs = Dezi3 $ map (\x -> testInt x) xs
In last statement I'm trying to create generic instance for my type class I asume that type 'a' is Int or String, but compiler is not happy:
`Dezi' is applied to too many type arguments
In the instance declaration for `TestInterface [a]'
I'm beginner and still in learning process.
Thanks!