News for hackers. Stuff that matters.
Re:Currying in JavaScript by neurotrace on Sunday September 19, 2021 @10:10AM (#28584449)
I didn't think I had to make this clear but a lot of people seem to be getting stuck on the specifics of my example code. That example is doing nothing but showing a 5,000 foot view of what pipelines can do. Please don't take my dumb example that was written early in the morning as The One True Way of processing data, sending emails, or handling errors. It's a horrible example of that
Re:Currying in JavaScript by z3t4 on Sunday September 19, 2021 @12:43PM (#28585718)
Simplified examples always look neat. Any code/syntax will look simple if it doesn't have async, state and error handling.
Re:Currying in JavaScript by neurotrace on Sunday September 19, 2021 @02:06PM (#28586485)
I can't be bothered to type all of it out on my phone but even adding in those pieces, it doesn't change it much. This is F# so you can easily manage the async via an async computation expression, the retry logic can be encapsulated in the `sendEmails` function, and the error handling is reduced to a `Result` which is very easy to work with in a pipeline. Not everything should be done in a pipeline but pipelines make a lot of things a lot nicer