on master help sign in
Minor changes to checks for ports
commit63243ca457d6d3a67b4c01ee9699a8b00bdd7116 authorEvan Czaplicki <info@elm-lang.org> dateMon 13 Jan 2014, 19:24 (13 years ago) parent329077f
1 file changed+4−7
compiler/Type/ExtraChecks.hs+4−7
compiler/Type/ExtraChecks.hs+4−7
@@ -47,12 +47,9 @@ data Direction = In | Out
4747
4848portTypes :: Alias.Rules -> E.LExpr -> Either [P.Doc] ()
4949portTypes rules expr =
50− const () <$> Expr.checkPorts checkIn checkOut expr
50+ const () <$> Expr.checkPorts (check In) (check Out) expr
5151 where
52− checkIn name st _ = isValidType In name st
53− checkOut name st = isValidType Out name st
54−
55− isValidType = isValid True
52+ check = isValid True
5653 isValid firstOrder direction name tipe =
5754 let valid = isValid firstOrder direction name in
5855 case tipe of
@@ -81,7 +78,7 @@ portTypes rules expr =
8178 && length (filter (=='.') ctor) == 1
8279
8380 isElm ctor =
84− ctor `elem` ["Int","Float","String","Maybe.Maybe","_List","Signal.Signal"]
81+ ctor `elem` ["Int","Float","String","Bool","Maybe.Maybe","_List","Signal.Signal"]
8582 || Help.isTuple ctor
8683
8784 dir inMsg outMsg = case direction of { In -> inMsg ; Out -> outMsg }
@@ -93,7 +90,7 @@ portTypes rules expr =
9390 , " through port '", name, "' is invalid." ]
9491 , txt [ "Acceptable values for ", dir "incoming" "outgoing"
9592 , " ports include JavaScript values and the following Elm values:" ]
96− , txt [ "Ints, Floats, Strings, Maybes, Lists, Tuples, "
93+ , txt [ "Ints, Floats, Bools, Strings, Maybes, Lists, Tuples, "
9794 , dir "" "first-order functions, ", "and concrete records." ]
9895 , txt [ "The values sent through this port contain ", kind, ":\n" ]
9996 , (P.nest 4 . pretty $ Alias.realias rules tipe) <> P.text "\n"