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 wheretest :: a -> BoolI wasn't to define the rules when test returns True/False for various types, e.g.instance Tester Integer wheretest 0 = Falsetest _ = TrueFor the Maybe instance I want to delegate to the value of Just and add a class constraint:instance (Tester m) => Tester (Maybe m) wheretest Nothing = Falsetest (Just x) = test xIt compiles nicely and works for Just valuestest (Just 3) -- Truetest (Just 0) -- FalseButtest Nothinggives meNo instance for (Tester a0) arising from a use of `test'The type variable `a0' is ambiguousPossible 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 IntegerIn the expression: test NothingCould you please enlighten me what's going on and how to fix my code?Thank you!Robert
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners