Skip to content

Allow 'chained functions' in top level call expressions #21

@stuartc

Description

@stuartc

If you try and create an expression like this:

get(
  "http://localhost:9292?flip=left"
).then(console.log.bind(console))

Turns into:

(function() {
  return execute(get(
    "http://localhost:9292?flip=left"
  ).then(console.log.bind(console)))(state);
})();

The compiler attaches the ...(state) callExpression onto the .then instead of the operation. This makes sense given how everything was originally designed - however it would be really nice not to have to use alterState in order to do this.

What we really want is the compiler to know that (in this case), get is an operation that needs to be called with state and add the call expression to that instead:

(function() {
  return execute(get(
    "http://localhost:9292?flip=left"
  )(state).then(console.log.bind(console)));    // <== callExpression on Operation instead
})();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions