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