
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 proofs. http://homepages.inf.ed.ac.uk/wadler/papers/free/free.ps is the canonical paper on deriving free theorems from Hindley-Milner type systems. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH