These are chat archives for ramda/ramda

19th
Oct 2016
Travis LaDuke
@laduke
Oct 19 2016 01:57 UTC
This message was deleted
Travis LaDuke
@laduke
Oct 19 2016 04:44 UTC
They should call it Right.of and Wrong.of
David Chambers
@davidchambers
Oct 19 2016 07:54 UTC
You could define these aliases in your own code if you like, @laduke. The thing is that the left and right values needn't represent failure and success (though this is a common pattern).
Craig Dallimore
@craigdallimore
Oct 19 2016 14:33 UTC

It totally messes me up when I do write promises:

new Promise((resolve, reject) => ...

I was doing

new Promise((reject, resolve) => ...

(thinking Left, Right)

Agree, Future is far nicer to work with
Ryan Zeigler
@rzeigler
Oct 19 2016 14:33 UTC
that's unfortunate
i occasionally try and map or chain promises and then feel stupid
especially when its in a seldom used branch
Craig Dallimore
@craigdallimore
Oct 19 2016 14:35 UTC
This is what brings us to Fantasyland
Keith Alexander
@kwijibo
Oct 19 2016 15:31 UTC

@davidchambers

avoid most of the complexity of promises.

what did you have in mind there?

Keith Alexander
@kwijibo
Oct 19 2016 15:41 UTC

@laduke
A low-effort solution is probably something like

pipe(f, g, pipeP(h, i))

but IIRC pipeP and composeP are (probably?) being deprecated
so you could do:

const then = f => p => p.then(f)
const catchError = f => p => p.catch(f)
pipe(f, g, h, then(i), catchError(ef))

Presumably the gold standard futurized solution is like:

const j = pipe(f, g, futurize(Future)(h), map(i))
j(x).fork(errorF, successF)
Travis LaDuke
@laduke
Oct 19 2016 16:21 UTC
Was goofing around with the Wrong.of comment, but at least I'll remember the convention now with that mnemonic.
Keith Alexander
@kwijibo
Oct 19 2016 17:12 UTC
I think of the semantics as being Either Stop Continue
Brad Compton (he/him)
@Bradcomp
Oct 19 2016 17:14 UTC
:point_up: Me too! I was gonna come up with a try things until one works example, but I just didn't get around to it...
David Chambers
@davidchambers
Oct 19 2016 17:52 UTC
@kwijibo, are you familiar with the async problem?
Keith Alexander
@kwijibo
Oct 19 2016 17:57 UTC
Yes
David Chambers
@davidchambers
Oct 19 2016 18:14 UTC
That's what I have in mind when I refer to "the complexity of promises".