on master help sign in
Rename Promise to Command
commit74a4b6a4df58bc1422ad852ed0f03146d8aa2652 authorEvan Czaplicki <info@elm-lang.org> dateSun 15 Mar 2015, 17:42 (12 years ago) parent552becc
7 files changed+20−20
src/AST/Declaration.hs+4−4 src/AST/Expression/General.hs+1−1 src/AST/Variable.hs+3−3 src/Generate/JavaScript.hs+1−1 src/Transform/Canonicalize.hs+1−1 src/Transform/Canonicalize/Wire.hs+7−7 src/Transform/Declaration.hs+3−3
src/AST/Declaration.hs+4−4
@@ -61,7 +61,7 @@ data ValidLoopback =
6161
6262data CanonicalLoopback
6363 = Address String T.CanonicalType
64− | Promise String T.CanonicalType Canonical.Expr T.CanonicalType
64+ | Command String T.CanonicalType Canonical.Expr T.CanonicalType
6565
6666
6767type ValidWire =
@@ -180,7 +180,7 @@ instance Pretty ValidLoopback where
180180 pretty (ValidLoopback name maybeExpr tipe) =
181181 P.vcat
182182 [ prettyWire "input" name ":" tipe
183− , maybe P.empty (prettyWire "input" name "<-") maybeExpr
183+ , maybe P.empty (prettyWire "input" name "with") maybeExpr
184184 ]
185185
186186
@@ -190,10 +190,10 @@ instance Pretty CanonicalLoopback where
190190 Address name tipe ->
191191 prettyWire "input" name ":" tipe
192192
193− Promise name _promiseType expr resultType ->
193+ Command name _commandType expr resultType ->
194194 P.vcat
195195 [ prettyWire "input" name ":" resultType
196− , prettyWire "input" name "<-" expr
196+ , prettyWire "input" name "with" expr
197197 ]
198198
199199
src/AST/Expression/General.hs+1−1
@@ -68,7 +68,7 @@ data Expr' ann def var
6868
6969data Source
7070 = Address
71− | PromiseStream
71+ | CommandStream
7272 deriving (Show)
7373
7474
src/AST/Variable.hs+3−3
@@ -78,9 +78,9 @@ isVarying =
7878 is ["Signal"] "Varying"
7979
8080
81−isPromise :: Canonical -> Bool
82−isPromise =
83− is ["Promise"] "Promise"
81+isCommand :: Canonical -> Bool
82+isCommand =
83+ is ["Command"] "Command"
8484
8585
8686isResult :: Canonical -> Bool
src/Generate/JavaScript.hs+1−1
@@ -219,7 +219,7 @@ expression (A region expr) =
219219 Address ->
220220 return $ obj ["_P","input"] `call` [ string name ]
221221
222− PromiseStream ->
222+ CommandStream ->
223223 return $ obj ["_P","loopbackIn"] `call` [ string name ]
224224
225225 LoopbackOut name expr ->
src/Transform/Canonicalize.hs+1−1
@@ -86,7 +86,7 @@ moduleHelp interfaces modul@(Module.Module _ _ exports _ decls) =
8686 D.Input name _ -> name
8787 D.Output name _ _ -> name
8888 D.Loopback (D.Address name _) -> name
89− D.Loopback (D.Promise name _ _ _) -> name
89+ D.Loopback (D.Command name _ _ _) -> name
9090
9191
9292resolveExports
src/Transform/Canonicalize/Wire.hs+7−7
@@ -138,7 +138,7 @@ foreignError name direction rootType localType problemMessage =
138138 , P.nest 4 (PP.pretty localType) <> P.text "\n"
139139 , txt [ "Acceptable values for foreign ", wire, "s include:" ]
140140 , 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." ]
142142 ]
143143 ]
144144 where
@@ -179,16 +179,16 @@ input name maybeExpr tipe =
179179 case ST.deepDealias tipe of
180180 ST.App (ST.Type signal) [ ST.App (ST.Type result) [failure,success] ]
181181 | Var.isStream signal && Var.isResult result ->
182− let promise =
183− Var.fromModule ["Promise"] "Promise"
184− promiseType =
185− ST.App (ST.Type signal) [ ST.App (ST.Type promise) [failure,success] ]
182+ let command =
183+ Var.fromModule ["Command"] "Command"
184+ commandType =
185+ ST.App (ST.Type signal) [ ST.App (ST.Type command) [failure,success] ]
186186 in
187− return (D.Promise name promiseType expr tipe)
187+ return (D.Command name commandType expr tipe)
188188
189189 _ ->
190190 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."
192192 , P.text "Something like the following:\n"
193193 , P.text " Stream (Result Http.Error String)"
194194 , P.text " Stream (Result x ())"
src/Transform/Declaration.hs+3−3
@@ -154,12 +154,12 @@ toDefs moduleName decl =
154154 D.Address name tipe ->
155155 [ definition name (A.none $ E.LoopbackIn name E.Address) tipe ]
156156
157− D.Promise name promiseType expr resultType ->
157+ D.Command name commandType expr resultType ->
158158 let dummyName =
159159 "$" ++ name ++ "$effect"
160160 in
161− [ definition name (A.none $ E.LoopbackIn name E.PromiseStream) resultType
162− , definition dummyName (A.none $ E.LoopbackOut name expr) promiseType
161+ [ definition name (A.none $ E.LoopbackIn name E.CommandStream) resultType
162+ , definition dummyName (A.none $ E.LoopbackOut name expr) commandType
163163 ]
164164
165165 -- no constraints are needed for fixity declarations