These are chat archives for ramda/ramda
I do, its all closed source though :( and its kind of too big to work as a gist. I'll think about how I can extract some of out into a library at some point and open source it. @svozza
But its really just the Elm architecture but instead of using
StartApp as the only interpreter, you also have something like
ServerSideRenderApp. There's nothing about that pattern that requires it to only be used client side, I used it server side to write a task queue, but I also use it client side for components. Its not Elm but I pretended it was using https://github.com/paldepind/flyd and https://github.com/JAForbes/sum-type.
Object.createwill use the given object argument as the prototype for the created object, rather than direct properties.
console.logimplemented in the REPL presumably only displays the own enumerable properties.
How would you refactor
to allow for
testX needing to do asynchronous computation?
//testX :: a -> Future Maybe a //instead of a -> Boolean R.pipe( R.traverse(Future.of, testConstraint), // Future List Maybe testConstraint R.reduce(R.concat), R.map(S.maybeToNullable) )(xs)
pipe( traverse(Future.of, testConstraint), map(S.justs) );
justsfor whatever Maybe you're using
testXreturn true if it passed Just to it, they would.
R.filter(testX)(xs), if you managed to do the async task and pass that result as
xsit will yield same results?
R.filter(testX)rather than wrap it all on your Future. if you can extract your computation out of you monad then use it instead.
testXis hitting a web service that will return true or false
R.filter(isOddAsync)([1,2,3,4])... I can imagine getting a
Futureof an array of booleans, and then matching up the indexes to the input array of values in order to filter it, but that also seems quite complicated
filterimplementations on Sanctuary for other ideas on how to implement filter in terms of the type classes: https://github.com/sanctuary-js/sanctuary-type-classes#filter--applicativeffoldablefmonoidfa--a-booleanfa---fa
a -> Boleanwhich is the whole issue.
// keep this pure, Array Int -> Array Int oddNumber = R.filter(isOdd) // here we fetch web service Array Int -> Future (Array Int) fetchService = R.traverse(Future.of, doRequest) // an here we use our pure f oddNumberAsync = R.compose(R.map(oddNumber), fetchService)