sam-goodwin / punchcard

Type-safe AWS infrastructure.
Apache License 2.0
507 stars 20 forks source link

monadic step functions #2

Open sam-goodwin opened 5 years ago

sam-goodwin commented 5 years ago

I'm wondering if we can build a functional/monadic interface for AWS Step Functions:

Sources for inspiration:

// a rough sketch of what it may look like:
*function() {
  const runFunction = yield new Function(...);

  const choice = yield new Choice(...)

  return yield new Parallel(...)
}
joaomilho commented 2 years ago

Any progress on this idea, or perhaps some similar project elsewhere?

sam-goodwin commented 2 years ago

No, I haven't been working on punchcard for a while but I'd love to circle back to this. I did try hooking into the typescript compiler to convert regular if-else, for, while syntax to step functions - that looked promising.

Do you have any ideas? Are you using punchcard or looking for somethings standalone/simpler?

joaomilho commented 2 years ago

I played with it but nothing in production. As far as I recall I had some issues around the decoding of enums, and went for zod instead.

But yeah, I would prefer something simple or just focused on making step fns type safe, it doesn't even be something that would parse "*" functions in do notation or anything like that, just plain good old types covering all states (choice, parallel, etc) and all of @aws-cdk/aws-stepfunctions-tasks.