on master help sign in
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.

commit461abc0c6fbacd23cf181c4e26e27345a9982abd authorEvan Czaplicki <info@elm-lang.org> dateTue 14 Jan 2014, 12:49 (13 years ago) parent6c1d2d7
1 file changed+3−4
compiler/Type/ExtraChecks.hs+3−4
compiler/Type/ExtraChecks.hs+3−4
@@ -58,12 +58,11 @@ portTypes rules expr =
5858
5959 T.Var _ -> err "free type variables"
6060
61− T.Lambda t1 t2 ->
61+ T.Lambda _ _ ->
6262 case direction of
6363 In -> err "functions"
64− Out | firstOrder -> do isValid False direction name t1
65− valid t2
66− | otherwise -> err "higher-order functions"
64+ Out | firstOrder -> mapM_ (isValid False direction name) (T.collectLambdas tipe)
65+ | otherwise -> err "higher-order functions"
6766
6867 T.Record _ (Just _) -> err "extended records with free type variables"
6968