[Haskell-beginners] Meaning of (Eq a)

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Sun Sep 5 10:47:40 EDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 9/5/10 04:58 , Rohit Garg wrote:
> Although it works, my question is why ghci refuses to run it without
> the "(Eq a) => " being added to the type signature of the function.

Haskell won't do type inference if you provide a function with a type
signature, so if you say anything at all you need to say everything about
it.  If you say *nothing* about it, as with the second function, Haskell
will infer everything including required constraints.

- -- 
brandon s. allbery     [linux,solaris,freebsd,perl]      allbery at kf8nh.com
system administrator  [openafs,heimdal,too many hats]  allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university      KF8NH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyDrYwACgkQIn7hlCsL25U60ACguFkSUsfyPdk77Q7AmA5McVcu
0S0An3lbVUtVyzGCd6SSer2bksufokpd
=NAqj
-----END PGP SIGNATURE-----


More information about the Beginners mailing list