CSC448: Type Checking Revisited: Let Polymorphism I [121/133] Previous pageContentsNext page

Why is let x = M in N more difficult?

let take = 
  fun f i => 
    fun g xs => 
      if (is_zero (i)) then
        []
      else
        cons (head (xs)) (f (i - 1) (tail (xs)))
in
  (length (take 2 ["a", "b", "c"])) + (length (take 1 [1, 2, 3]))
        

We need take to be bound to a type scheme instead of a type.

Previous pageContentsNext page