Type Eq a => adoes not mean "Type that implements Eq", but "Any type that implements Eq. For example, if you implement your function using undefined:
getAnyEq :: (Eq a) => String -> a
getAnyEq str = undefined
( undefined ):
x,y,z :: Bool
x = getAnyEq "test" == "hello"
y = getAnyEq "test" == [Just (Right True)]
z = getAnyEq "test" == ("this", "sss")
, .
, , , , , . , Num:
class (Eq a, Show a) => Num a where
(+) :: a -> a -> a
(*) :: a -> a -> a
(-) :: a -> a -> a
negate :: a -> a
abs :: a -> a
signum :: a -> a
fromInteger :: Integer -> a
( , ghc, Num Eq Show).
fromInteger a ( a), a . , . , :
getANum:: (Num a) => String -> a
getANum "zero" = fromInteger 0
getANum "asdf" = fromInteger 46
getANum _ = fromInteger 1
> getANum "asdf"
46
, fromInteger <num>, fromInteger, , . , , .
, , :
Monad ( return)Applicative ( pure)Monoid ( mempty)Read ( Read )