@@ -65,7 +65,7 @@ portTypes expr =
66 | V.isJson v -> return ()
66 | V.isJson v -> return ()
67 | V.isPrimitive v -> return ()
67 | V.isPrimitive v -> return ()
68− | otherwise -> err' True "an unsupported type"
68+ | otherwise -> err "an unsupported type"
70 ST.App t [] -> valid t
70 ST.App t [] -> valid t
@@ -78,7 +78,7 @@ portTypes expr =
78 ST.App (ST.Type v) ts
78 ST.App (ST.Type v) ts
79 | V.isTuple v -> mapM_ valid ts
79 | V.isTuple v -> mapM_ valid ts
81− ST.App _ _ -> err' True "an unsupported type"
81+ ST.App _ _ -> err "an unsupported type"
83 ST.Var _ -> err "free type variables"
83 ST.Var _ -> err "free type variables"
@@ -109,8 +109,7 @@ portTypes expr =
109 dir inMsg outMsg = case direction of { In -> inMsg ; Out -> outMsg }
109 dir inMsg outMsg = case direction of { In -> inMsg ; Out -> outMsg }
110 txt = P.text . concat
110 txt = P.text . concat
112− err = err' False
112+ err kind =
113− err' couldBeAlias kind =
115 [ txt [ "Type Error: the value ", dir "coming in" "sent out"
114 [ txt [ "Type Error: the value ", dir "coming in" "sent out"
116 , " through port '", name, "' is invalid." ]
115 , " through port '", name, "' is invalid." ]
@@ -119,11 +118,6 @@ portTypes expr =
119 , txt [ "Acceptable values for ", dir "incoming" "outgoing", " ports include:" ]
118 , txt [ "Acceptable values for ", dir "incoming" "outgoing", " ports include:" ]
120 , txt [ " Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples," ]
119 , txt [ " Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples," ]
121 , txt [ " Json.Values, ", dir "" "first-order functions, ", "and concrete records." ]
120 , txt [ " Json.Values, ", dir "" "first-order functions, ", "and concrete records." ]
122− ] ++ if couldBeAlias then aliasWarning else []
125− [ txt [ "\nType aliases are not expanded for this check (yet) so you need to do that" ]
126− , txt [ "manually for now (e.g. {x:Int,y:Int} instead of a type alias of that type)." ]
129occurs :: (String, TT.Variable) -> StateT TS.SolverState IO ()
123occurs :: (String, TT.Variable) -> StateT TS.SolverState IO ()