Function composition: fix the typing of the generated lambda

When f and g are functions, 'f ; g' gets translated into
  lambda x: g (f x)

The resulting function wasn't typed right, which led to an internal error.

This fixes bug #328