Next Atypical Types 50

Type Inference

sumof ::[a] -> b

"The argument has type [a]."

        sumof []    = 0
        sumof (h:t) = h + sumof t

"h:t is also a list, so that's okay."

"h must have type a and t must have type [a]."

       h :: a
       t :: [a]


Next Copyright © 1999,2008 Mark Dominus