on master help sign in
Rename Promise to Command
74a4b6aEvan Czaplicki
src/AST/Declaration.hs+4−4
@@ -61,7 +61,7 @@ data ValidLoopback =
61
61
62data CanonicalLoopback
62data CanonicalLoopback
63 = Address String T.CanonicalType
63 = Address String T.CanonicalType
64− | Promise String T.CanonicalType Canonical.Expr T.CanonicalType
64+ | Command String T.CanonicalType Canonical.Expr T.CanonicalType
65
65
66
66
67type ValidWire =
67type ValidWire =
@@ -180,7 +180,7 @@ instance Pretty ValidLoopback where
180 pretty (ValidLoopback name maybeExpr tipe) =
180 pretty (ValidLoopback name maybeExpr tipe) =
181 P.vcat
181 P.vcat
182 [ prettyWire "input" name ":" tipe
182 [ prettyWire "input" name ":" tipe
183− , maybe P.empty (prettyWire "input" name "<-") maybeExpr
183+ , maybe P.empty (prettyWire "input" name "with") maybeExpr
184 ]
184 ]
185
185
186
186
@@ -190,10 +190,10 @@ instance Pretty CanonicalLoopback where
190 Address name tipe ->
190 Address name tipe ->
191 prettyWire "input" name ":" tipe
191 prettyWire "input" name ":" tipe
192
192
193− Promise name _promiseType expr resultType ->
193+ Command name _commandType expr resultType ->
194 P.vcat
194 P.vcat
195 [ prettyWire "input" name ":" resultType
195 [ prettyWire "input" name ":" resultType
196− , prettyWire "input" name "<-" expr
196+ , prettyWire "input" name "with" expr
197 ]
197 ]
198
198
199
199
src/AST/Expression/General.hs+1−1
@@ -68,7 +68,7 @@ data Expr' ann def var
68
68
69data Source
69data Source
70 = Address
70 = Address
71− | PromiseStream
71+ | CommandStream
72 deriving (Show)
72 deriving (Show)
73
73
74
74
src/AST/Variable.hs+3−3
@@ -78,9 +78,9 @@ isVarying =
78 is ["Signal"] "Varying"
78 is ["Signal"] "Varying"
79
79
80
80
81−isPromise :: Canonical -> Bool
81+isCommand :: Canonical -> Bool
82−isPromise =
82+isCommand =
83− is ["Promise"] "Promise"
83+ is ["Command"] "Command"
84
84
85
85
86isResult :: Canonical -> Bool
86isResult :: Canonical -> Bool
src/Generate/JavaScript.hs+1−1
@@ -219,7 +219,7 @@ expression (A region expr) =
219 Address ->
219 Address ->
220 return $ obj ["_P","input"] `call` [ string name ]
220 return $ obj ["_P","input"] `call` [ string name ]
221
221
222− PromiseStream ->
222+ CommandStream ->
223 return $ obj ["_P","loopbackIn"] `call` [ string name ]
223 return $ obj ["_P","loopbackIn"] `call` [ string name ]
224
224
225 LoopbackOut name expr ->
225 LoopbackOut name expr ->
src/Transform/Canonicalize.hs+1−1
@@ -86,7 +86,7 @@ moduleHelp interfaces modul@(Module.Module _ _ exports _ decls) =
86 D.Input name _ -> name
86 D.Input name _ -> name
87 D.Output name _ _ -> name
87 D.Output name _ _ -> name
88 D.Loopback (D.Address name _) -> name
88 D.Loopback (D.Address name _) -> name
89− D.Loopback (D.Promise name _ _ _) -> name
89+ D.Loopback (D.Command name _ _ _) -> name
90
90
91
91
92resolveExports
92resolveExports
src/Transform/Canonicalize/Wire.hs+7−7
@@ -138,7 +138,7 @@ foreignError name direction rootType localType problemMessage =
138 , P.nest 4 (PP.pretty localType) <> P.text "\n"
138 , P.nest 4 (PP.pretty localType) <> P.text "\n"
139 , txt [ "Acceptable values for foreign ", wire, "s include:" ]
139 , txt [ "Acceptable values for foreign ", wire, "s include:" ]
140 , txt [ " Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples, unit values," ]
140 , txt [ " Ints, Floats, Bools, Strings, Maybes, Lists, Arrays, Tuples, unit values," ]
141− , txt [ " Json.Values, ", dir "" "first-order functions, promises, ", "and concrete records." ]
141+ , txt [ " Json.Values, ", dir "" "first-order functions, commands, ", "and concrete records." ]
142 ]
142 ]
143 ]
143 ]
144 where
144 where
@@ -179,16 +179,16 @@ input name maybeExpr tipe =
179 case ST.deepDealias tipe of
179 case ST.deepDealias tipe of
180 ST.App (ST.Type signal) [ ST.App (ST.Type result) [failure,success] ]
180 ST.App (ST.Type signal) [ ST.App (ST.Type result) [failure,success] ]
181 | Var.isStream signal && Var.isResult result ->
181 | Var.isStream signal && Var.isResult result ->
182− let promise =
182+ let command =
183− Var.fromModule ["Promise"] "Promise"
183+ Var.fromModule ["Command"] "Command"
184− promiseType =
184+ commandType =
185− ST.App (ST.Type signal) [ ST.App (ST.Type promise) [failure,success] ]
185+ ST.App (ST.Type signal) [ ST.App (ST.Type command) [failure,success] ]
186 in
186 in
187− return (D.Promise name promiseType expr tipe)
187+ return (D.Command name commandType expr tipe)
188
188
189 _ ->
189 _ ->
190 throw $ inputError name tipe $
190 throw $ inputError name tipe $
191− [ P.text "An input that runs promises must be a stream of results."
191+ [ P.text "An input that runs commands must be a stream of results."
192 , P.text "Something like the following:\n"
192 , P.text "Something like the following:\n"
193 , P.text " Stream (Result Http.Error String)"
193 , P.text " Stream (Result Http.Error String)"
194 , P.text " Stream (Result x ())"
194 , P.text " Stream (Result x ())"
src/Transform/Declaration.hs+3−3
@@ -154,12 +154,12 @@ toDefs moduleName decl =
154 D.Address name tipe ->
154 D.Address name tipe ->
155 [ definition name (A.none $ E.LoopbackIn name E.Address) tipe ]
155 [ definition name (A.none $ E.LoopbackIn name E.Address) tipe ]
156
156
157− D.Promise name promiseType expr resultType ->
157+ D.Command name commandType expr resultType ->
158 let dummyName =
158 let dummyName =
159 "$" ++ name ++ "$effect"
159 "$" ++ name ++ "$effect"
160 in
160 in
161− [ definition name (A.none $ E.LoopbackIn name E.PromiseStream) resultType
161+ [ definition name (A.none $ E.LoopbackIn name E.CommandStream) resultType
162− , definition dummyName (A.none $ E.LoopbackOut name expr) promiseType
162+ , definition dummyName (A.none $ E.LoopbackOut name expr) commandType
163 ]
163 ]
164
164
165 -- no constraints are needed for fixity declarations
165 -- no constraints are needed for fixity declarations