Correct check for outgoing higher order functions

A function can appear arbitrarily nested in a data structure, but that
function cannot have more functions within it.
This commit is contained in:
Evan Czaplicki 2014-01-14 12:49:22 +01:00
parent 6c1d2d7bf3
commit 461abc0c6f

View file

@ -58,12 +58,11 @@ portTypes rules expr =
T.Var _ -> err "free type variables"
T.Lambda t1 t2 ->
T.Lambda _ _ ->
case direction of
In -> err "functions"
Out | firstOrder -> do isValid False direction name t1
valid t2
| otherwise -> err "higher-order functions"
Out | firstOrder -> mapM_ (isValid False direction name) (T.collectLambdas tipe)
| otherwise -> err "higher-order functions"
T.Record _ (Just _) -> err "extended records with free type variables"