[Haskell-cafe] type classes and logic

Brandon S Allbery KF8NH allbery at ece.cmu.edu
Sat Aug 28 11:19:03 EDT 2010


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

On 8/28/10 06:17 , Patrick Browne wrote:
> In the light of the above examples how should I interpret the
> class-to-subclass relation as logical implication? Is it
> a)  If BEING then HUMAN (sufficient condition): BEING => HUMAN
> b)  HUMAN is true only if BEING (necessary condition): HUMAN => BEING
> c) Neither?

(b).  But there's an additional wrinkle:  what it really says is "A HUMAN is
(...).  Oh, and it's a BEING too."  Which is to say, Haskell doesn't look at
BEING until *after* it's decided something is a HUMAN.  (Technically
speaking, constraints are not used when selecting an instance; they're
applied after the fact, and if the selected instance doesn't conform then it
throws a type error.)

- -- 
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/

iEYEARECAAYFAkx5KOcACgkQIn7hlCsL25UWyQCfTblcgeEfwOci9KE7leVs07aN
VT4AoJAwHqXoD6nbD+TZVRlAWj3N99SM
=jA0B
-----END PGP SIGNATURE-----


More information about the Haskell-Cafe mailing list