[Haskell-beginners] Type classes and synonyms

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Nov 22 10:45:04 EST 2009

On Nov 22, 2009, at 10:32 , pbrowne wrote:
> On Sat, Nov 21, 2009 at 21:08 Felipe Lessa wrote:
>> Most definitions, if not all, are just the corresponding free  
>> theorems
>> (meaning roughly that the definition follows from the type
>> because that's the only definition that doesn't have
>> undefined's).
> Question: Is it correct to paraphrase Felipe's description as follows:
> In Haskell the *term theorems for free* means roughly that the
> definition of a class, instance or a function follows from the  
> supplied
> types because they are the only types that don’t have undefined  
> argumens
> or undefined return types.

Pretty much.  It's not specific to Haskell, either; it's a result of  
the Curry-Howard correspondence between programs and mathematical  

http://homepages.inf.ed.ac.uk/wadler/papers/free/free.ps is the  
canonical paper on deriving free theorems from Hindley-Milner type  

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://www.haskell.org/pipermail/beginners/attachments/20091122/3964ba3f/PGP.bin

More information about the Beginners mailing list