let rec extract_type = function
| ETypeConstraint (_, e, typ) ->
typ, e
| ELambda (pos, PTypeConstraint (pos', p, typ1), e2) ->
let typ2, e2 = extract_type e2 in
TypApp (pos', TypVar (pos', TName "->"), [typ1; typ2]),
ELambda (pos, p, e2)
| _ ->
raise Not_found