@@ -47,12 +47,9 @@ data Direction = In | Out
48portTypes :: Alias.Rules -> E.LExpr -> Either [P.Doc] ()
48portTypes :: Alias.Rules -> E.LExpr -> Either [P.Doc] ()
49portTypes rules expr =
49portTypes rules expr =
50− const () <$> Expr.checkPorts checkIn checkOut expr
50+ const () <$> Expr.checkPorts (check In) (check Out) expr
52− checkIn name st _ = isValidType In name st
53− checkOut name st = isValidType Out name st
55− isValidType = isValid True
52+ check = isValid True
56 isValid firstOrder direction name tipe =
53 isValid firstOrder direction name tipe =
57 let valid = isValid firstOrder direction name in
54 let valid = isValid firstOrder direction name in
58 case tipe of
55 case tipe of
@@ -81,7 +78,7 @@ portTypes rules expr =
81 && length (filter (=='.') ctor) == 1
78 && length (filter (=='.') ctor) == 1
83 isElm ctor =
80 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"]
85 || Help.isTuple ctor
82 || Help.isTuple ctor
87 dir inMsg outMsg = case direction of { In -> inMsg ; Out -> outMsg }
84 dir inMsg outMsg = case direction of { In -> inMsg ; Out -> outMsg }
@@ -93,7 +90,7 @@ portTypes rules expr =
93 , " through port '", name, "' is invalid." ]
90 , " through port '", name, "' is invalid." ]
94 , txt [ "Acceptable values for ", dir "incoming" "outgoing"
91 , txt [ "Acceptable values for ", dir "incoming" "outgoing"
95 , " ports include JavaScript values and the following Elm values:" ]
92 , " 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, "
97 , dir "" "first-order functions, ", "and concrete records." ]
94 , dir "" "first-order functions, ", "and concrete records." ]
98 , txt [ "The values sent through this port contain ", kind, ":\n" ]
95 , txt [ "The values sent through this port contain ", kind, ":\n" ]
99 , (P.nest 4 . pretty $ Alias.realias rules tipe) <> P.text "\n"
96 , (P.nest 4 . pretty $ Alias.realias rules tipe) <> P.text "\n"