Next Atypical Types 58

Type Inference

map ::(a -> b, [a]) -> [b]
f ::a -> b
h ::a
t ::[a]

"map must return [b]."

        map(f, []) =  [] 
        map(f, h:t) = f(h) : [map(f, t)

"That fits with the return value in the other clause."

"Everything else checks out okay."

         map :: (a -> b, [a]) -> [b]


Next Copyright © 1999,2008 Mark Dominus