Haskell basic classes
haskell
Solution
Let's open up the GHC prompt and look at the types of things:
Prelude> :t not
not :: Bool -> Bool
Prelude> :t (not .)
(not .) :: (a -> Bool) -> a -> Bool
So you can see `(not .)` takes a `a -> Bool`, not an `a -> a -> Bool`. We can double up the function composition to get a working version:
Prelude> :t ((not .) .)
((not .) .) :: (a -> a1 -> Bool) -> a -> a1 -> Bool
So the correct definition is:
isNotEqual = (not .) . isEqual
Or equivalently,
isNotEqual x y = not $ isEqual x y
isNotEqual = curry $ not . uncurry isEqual
et cetera.
Problem
Rookie question, why this is not correct in Haskell? ``` class BasicEq a where isEqual :: a -> a -> Bool isNotEqual :: a -> a -> Bool isNotEqual = not . isEqual ```