Next Atypical Types 57

Type Inference

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

"f must take an argument of type a and return a result of type b."

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

"The result of f is consed to the result of map."

"So map must return [b]."

Next Copyright © 1999,2008 Mark Dominus