Closed iyegoroff closed 4 years ago
Hi @ncthbrt ! What do you think about railway oriented programming?
I'm a big fan of RoP. This is actually a pretty nice suggestion.
Another approach I tried internally was creating a wrapper around Promise that only allowed for then
(Vows), but I didn't want to make it public as it's a non-standard abstraction, and added a certain amount of overhead as you had to convert back and forth between promises and vows.
I'm game for making this change.
Will require a major version bump however
@iyegoroff: Update on this. I'm happy to implement this myself, but it'll only be in a few weeks time. Got a deadline for another personal project in the first week of December, so can't really devote the time that this deserves till after this (know it isn't a huge feature, but it's more of a context switching thing)
If you're willing, I'd happily accept a PR for ROP effect creators
Sure, probably I could look at it on this weekend.
Also I just played a little with this module and I really like the idea of bringing elmish approach to mainstream land with Typescript. I think that 'react-use-elmish' has huge potential!
@iyegoroff Offtopic (and currently under documented), but also created this companion library: https://github.com/ncthbrt/react-elmish-router
Thanks a lot for your work @iyegoroff I've just published the new version to npm
That's great! Thanks!
Hi @ncthbrt ! What do you think about railway oriented programming?
Enforcing users to always implement "failure path" looks like an interesting idea to me. For example, signatures of
fromFunction
&fromPromise
could be changed this way:ofError
action is being dispatched when function/promise throws an exception andofSuccess
otherwise. Elmish message creator functions follow similar interface - https://github.com/elmish/elmish/blob/12648f57092ac6c3dca383e1c25995882a646447/src/cmd.fs#L47