
Hi everyone, I'm currently enjoying to learn Haskell and came upon a problem I don't understand: Motivated by the Learn you a Haskell / yes-no typeclass example I tried to create a simple "Tester" type class: class Tester a where test :: a -> Bool I wasn't to define the rules when test returns True/False for various types, e.g. instance Tester Integer where test 0 = False test _ = True For the Maybe instance I want to delegate to the value of Just and add a class constraint: instance (Tester m) => Tester (Maybe m) where test Nothing = False test (Just x) = test x It compiles nicely and works for Just values test (Just 3) -- True test (Just 0) -- False But test Nothing gives me No instance for (Tester a0) arising from a use of `test' The type variable `a0' is ambiguous Possible fix: add a type signature that fixes these type variable(s) Note: there are several potential instances: instance Tester m => Tester (Maybe m) instance Tester Integer In the expression: test Nothing Could you please enlighten me what's going on and how to fix my code? Thank you! Robert