These are chat archives for ramda/ramda

1st
Dec 2015
Scott Christopher
@scott-christopher
Dec 01 2015 00:00
That was part of my reasoning behind wanting to remove success/failure from Future in RF.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:01
@scott-christopher in exchange for what?
or just in exchange for nothing
:)
Scott Christopher
@scott-christopher
Dec 01 2015 00:01
In exchange for a Future just representing something async
If you need error handling, capture it in the data type contained in the Future
David Chambers
@davidchambers
Dec 01 2015 00:02
Scott, didn't you also suggest having Task as sugar for Future (Either a b)?
joneshf-work1
@joneshf-work1
Dec 01 2015 00:02
yeah
Scott Christopher
@scott-christopher
Dec 01 2015 00:03
@joneshf-work1: I'm actually curious to know whether something like ContT IO could be used to model a Future. Or would that introduce more headaches than it would be worth?
@davidchambers Yeah, I've started playing around with that but haven't had a whole lot of time recently.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:04
probably you want FutureT (Either a) b though
so it's not a pain in the ass to actually use
@scott-christopher I'm not sure about that.
Scott Christopher
@scott-christopher
Dec 01 2015 00:05
I've got some prototypes of using Free to represent an AST for both IO and Future.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:06
I think that depends on what IO means
because Future isn't necessarily side effectful
it could just be some long running process.
maybe you're computing something for the ui and don't want to block
but your copmutation is pure.
Scott Christopher
@scott-christopher
Dec 01 2015 00:07
but future.fork should arguably return an IO
joneshf-work1
@joneshf-work1
Dec 01 2015 00:07
why's that?
Scott Christopher
@scott-christopher
Dec 01 2015 00:09
In the instances where something is delayed, using setTimeout for instance, the return type will be void.
Should the return type of fork also be void in that instance?
joneshf-work1
@joneshf-work1
Dec 01 2015 00:10
what is the type of fork?
currently
doesn't it depend on the value of the future.
or rather, what should fork do?
Scott Christopher
@scott-christopher
Dec 01 2015 00:12
fork currently returns void
due to the continuation passing
joneshf-work1
@joneshf-work1
Dec 01 2015 00:12
So you can never pull a value out of a future?
Scott Christopher
@scott-christopher
Dec 01 2015 00:13
I think I'm just confusing myself now.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:13
say you wanted to block
and wait for the result
Scott Christopher
@scott-christopher
Dec 01 2015 00:13
You can't wait on fork, you can only pass a continuation function.
Essentially the same as a Promise
Except that its execution is delayed until fork is called.
If you want to block, IO may be more useful.
I'd also consider adding a forkIO function, which takes an IO and schedules it to run on the next tick.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:17
why is io more useful than future?
for blocking?
Scott Christopher
@scott-christopher
Dec 01 2015 00:17
Yeah, if you needed it to block.
You can still block and run within the same stack with a Promise, you're just stuck with using continuations.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:19
hmm, so is IO a sink for anything ever?
Scott Christopher
@scott-christopher
Dec 01 2015 00:20
async?
There's nothing async with the current implementation of IO in RF, but there's nothing stopping you from firing some async missile in a fire and forget manner in the function given to the IO constructor.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:22
what is it supposed to be used for?
Scott Christopher
@scott-christopher
Dec 01 2015 00:24
It was intended as a way to model side effects, leading to something akin to main = IO.runIO(app) at the edge of your application
joneshf-work1
@joneshf-work1
Dec 01 2015 00:27
any side effects?
Scott Christopher
@scott-christopher
Dec 01 2015 00:28
Yep.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:29
how do you know whats handled or not?
Scott Christopher
@scott-christopher
Dec 01 2015 00:30
in what sense?
joneshf-work1
@joneshf-work1
Dec 01 2015 00:32
async might seem like a side effect to some, but not to others
Scott Christopher
@scott-christopher
Dec 01 2015 00:32
There's really not much to the IO implementation in RF. It's pretty much just the functor, applicative and monad instances for a Function0
purescript-aff looks like a good example of something for us to perhaps take inspiration for Future in RF.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:39
or ps-aff could provide a non-painful api to use from the js side
then there's limited work to be done, but you get to know the implementation is correct
Scott Christopher
@scott-christopher
Dec 01 2015 00:40
I haven't actually looked into intrerop of using PS libs in JS.
joneshf-work1
@joneshf-work1
Dec 01 2015 00:40
or rather, you get better assurance that it almost certainly is
what ever happened to us converting the pipes library?
:)
Scott Christopher
@scott-christopher
Dec 01 2015 00:41
...
one day, I'll invent the 25 hour day
joneshf-work1
@joneshf-work1
Dec 01 2015 00:42
haha
Scott Christopher
@scott-christopher
Dec 01 2015 00:43
I've started disciplining myself to use my commute on the train to writing docs, starting with RF. Perhaps a better use of my time than mindlessly browsing reddit.
Scott Sauyet
@CrossEye
Dec 01 2015 01:20
Been spending my bus commute writing as well. Long-form tech essays that some day will be in shape enough to share. But has kept me out of most of my other side projects for much of the last two months. It's nice to be writing again, though. After college, I was going to write the great American novel, and worked at odd jobs for a few years trying. Ended up with a series of great American first chapters and realized I probably should find another direction. Now at least it's only interfering with my spare time!
Chet Harrison
@ChetHarrison
Dec 01 2015 05:05
Yo @CrossEye and @scott-christopher I appreciate the contributions!!
Julien Goux
@jgoux
Dec 01 2015 10:42
Hi
Is there an equivalent to es6's endsWith function with Ramda ?
Raine Virta
@raine
Dec 01 2015 10:43
no
Julien Goux
@jgoux
Dec 01 2015 10:44
@raine ok thanks :)
Asaf
@asaf-romano
Dec 01 2015 20:36
is there something like ap that simulates the effect of useWith(ap, [identity, of])?
i.e. i want to run a list of functions on a single value
Brian Gates
@brian-gates
Dec 01 2015 20:37
Hi all. Is this the most popular Ramda room to seek help in?
Asaf
@asaf-romano
Dec 01 2015 20:37
I suppose converge is fine.
but then I need to chain the result
Raine Virta
@raine
Dec 01 2015 20:39
asaf-romano: search issues for juxt
asaf-romano: not sure if it's the same but might be
Isn't just going to take an array too
^^ that's what I'm trying to do.
Brian Gates
@brian-gates
Dec 01 2015 20:47
Is there a cleaner way to write this? https://gist.github.com/brian-gates/22e2e2c258d51d6b6c00
Brian Gates
@brian-gates
Dec 01 2015 20:53
/**
 * Convert URL query params to flattened db query params
 * e.g.
 * filterParams('capture', {
 *   id        : [ 'codex_capture_id', 'codex_second_day_capture_id' ],
 *   shot_name : [ 'CODEX_SHOT_0000065', 'DJI00056' ]
 * })
 * Results in:
 * {
 *   filter_capture__id_0        : 'codex_capture_id',
 *   filter_capture__id_1        : 'codex_second_day_capture_id',
 *   filter_capture__shot_name_0 : 'CODEX_SHOT_0000065',
 *   filter_capture__shot_name_1 : 'DJI00056'
 * }
 */
var filterParams = (node, filters) =>
  R
    .toPairs(filters)
    .reduce(
      (params, filterPair) =>
        filterPair[1].reduce(
          (acc, val, i) => R.assoc(`filter_${node}__${filterPair[0]}_${i}`, val, acc),
          params
        )
      ,
      {}
    )
;