[Haskell-cafe] Function Types

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Mon Oct 22 23:10:54 EDT 2007

On Oct 22, 2007, at 22:41 , PR Stanley wrote:

> f x = x
> x :: a
> f x :: b
> therefore f :: a -> b
> x = a and x = b
> therefore a = b
> therefore f :: a -> a
> Simple mappings are easy to work out. It's the more detailed stuff  
> I'm not sure about.
> f g x y = g x (y x)

I think you're looking for Hindley-Milner type inference.  (GHC  
actually uses a more complex system known as System Fc, but probably  
want to start with H-M.)  _Types and Programming Languages_ is a good  
place to start if you want to learn about the H-M family.

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

More information about the Haskell-Cafe mailing list