These are chat archives for ramda/ramda

26th
Oct 2015
Tobias Pflug
@gilligan
Oct 26 2015 07:24
morning ;)
@raine that ramda-t project looks interesting. Have to look into that. It uses the jsdoc annotation in ramda itself ?
Raine Virta
@raine
Oct 26 2015 07:30
yep, from node_modules/ramda/dist/ramda.js
Tobias Pflug
@gilligan
Oct 26 2015 07:30
interesting
@raine only the @param definitions or also @sig ?
Raine Virta
@raine
Oct 26 2015 07:35
just @param, leveraging @sig would be interesting
some para
some params are incorrect in 0.18 so it's easy to get false positives
Tobias Pflug
@gilligan
Oct 26 2015 07:38
would be interesting indeed but then it would have to be well defined first - i think it is at the moment somewhat arbitrary ?
@raine well, all the better if you find errors - so they can be fixed ;-)
Raine Virta
@raine
Oct 26 2015 07:39
i'm thinking there could be a less eager mode that shows a warning on exception only
right now it throws on first application of bad type
Tobias Pflug
@gilligan
Oct 26 2015 07:40
k
Raine Virta
@raine
Oct 26 2015 07:40
R.add('foo') too
Tobias Pflug
@gilligan
Oct 26 2015 07:40
i will give it a try today or tomorrow ;-)
Raine Virta
@raine
Oct 26 2015 07:45
it would be interesting to run it against the whole ramda test suite but I haven't done that yet
mostly tried it in my own projects and found some "abuse" of R.add https://github.com/ramda/ramda/pull/1459#issuecomment-150018700 :grinning:
Tobias Pflug
@gilligan
Oct 26 2015 07:54
;--)
Tobias Pflug
@gilligan
Oct 26 2015 08:00
@raine using your replem all the time now
Martin Algesten
@algesten
Oct 26 2015 08:01
me too.
i have this alias
alias ramda='replem --repl coffee-script/repl ramda:R!'
so i'm totally hooked on writing "ramda" whenever I want.
Tobias Pflug
@gilligan
Oct 26 2015 08:05
@raine thinking about ways to extend it in some ways - like one typical scenario for me is that i'm working on our big code base at work and then I want to try something. Firing up replem is nice but what would be even nice was if there was a somewhat seamless way to add context. Like i have some datastructure and i want to play with that in the repl. Perhaps I need to write a vim plugin that lets me select something which is then added to replem
Martin Algesten
@algesten
Oct 26 2015 08:06
how about a ~/.replem file in a project dir that lists a bunch of "require" that are automatically required into the context if you fire up replem in that project dir?
or more generically. look out for a <cwd>/.replem of additional includes that are path context specific.
Raine Virta
@raine
Oct 26 2015 08:28
@gilligan if you use tmux, there are vim plugins that send stuff over to other panes, useful with repls
Tobias Pflug
@gilligan
Oct 26 2015 08:29
@raine yep, actually i don't even need that because I am using nvim so I can use :terminal and just run replem inside vim
Raine Virta
@raine
Oct 26 2015 08:29
right, forgot
maybe there could be something like a .paste command that reads an object from clipboard
Tobias Pflug
@gilligan
Oct 26 2015 08:32
@raine right, the question is not how could i ever get data in there the question is how to make it convenient to send data in without adding too much stuff to replem that does not belong there - .paste could be nice though I guess
Raine Virta
@raine
Oct 26 2015 08:33
echo '{foo: 1}' | replem ramda exits immediately
but sends object to repl
Tobias Pflug
@gilligan
Oct 26 2015 08:34
yeah that's different
Raine Virta
@raine
Oct 26 2015 08:37
but could be useful if it didn't exit?
Tobias Pflug
@gilligan
Oct 26 2015 08:41
hm, right
was just wondering ...
echo '{x: 1, y: {a:1}}' | replem ramda
in the repl you have x = 1 and y={a:1}
but of course you would have to rell replem about the different invocations then
Raine Virta
@raine
Oct 26 2015 08:42
I don't know if it's possible to change how the repl module processes stdin
Tobias Pflug
@gilligan
Oct 26 2015 08:43
ah, good point
Raine Virta
@raine
Oct 26 2015 08:43
I think echo '{x: 1, y: {a:1}}' | replem ramda exits because process.stdin ends
Tobias Pflug
@gilligan
Oct 26 2015 08:44
perhaps some context file is the right approach after all
Raine Virta
@raine
Oct 26 2015 08:45
I think context file solves a separate problem
it doesn't really make getting data in repl easier
Tobias Pflug
@gilligan
Oct 26 2015 08:47
well it is "easy" to write a plugin that writes stuff to a file but then that is only good at startup of course
other than that.. i could imagine running an express instance accepting repl input
Raine Virta
@raine
Oct 26 2015 08:49
as a side note, I've been wanting something like .copy that would copy R.toString(_) i.e. last value to clipboard
Raine Virta
@raine
Oct 26 2015 08:55
@algesten @gilligan does it bother you that replem ramda:R is not instant even though you just ran it?
Tobias Pflug
@gilligan
Oct 26 2015 08:56
nah
Martin Algesten
@algesten
Oct 26 2015 09:02
a tiny bit. but not overly
Julien Goux
@jgoux
Oct 26 2015 13:52
Hello
Is it possible to use an async function with map ?
R.map(async (i) => await getAsyncStuff(i))(items)
Aldwin Vlasblom
@Avaq
Oct 26 2015 15:06
@jgoux Sure, but you'll get back a [Promise], which you can pass to something like Promise.all to commute it: http://goo.gl/qC22Nu
Julien Goux
@jgoux
Oct 26 2015 15:07
This was to chain with another sync operation in a pipe, but I think I can't await in the pipe :p
Aldwin Vlasblom
@Avaq
Oct 26 2015 15:07
You can use pipeP if you want to await in pipes.
Julien Goux
@jgoux
Oct 26 2015 15:08
awesome !
I didn't know about pipeP :D
Thanks @Avaq
joneshf-work1
@joneshf-work1
Oct 26 2015 22:16
I've got a not really ramda related question, but I think I'll get a better answer here than googling has done so far.
If I understand promises a+ correctly, there's no map. Is that true?
Scott Christopher
@scott-christopher
Oct 26 2015 22:17
then is both chain and map
(if you squint)
joneshf-work1
@joneshf-work1
Oct 26 2015 22:18
what, seriously?
Scott Christopher
@scott-christopher
Oct 26 2015 22:18
:)
you return a Promise from then, it behaves as a chain
joneshf-work1
@joneshf-work1
Oct 26 2015 22:18
well that's awful.
I thought they found out that was a bad idea
?
Scott Christopher
@scott-christopher
Oct 26 2015 22:18
I believe that's the source of the naming for Fantasy Land
joneshf-work1
@joneshf-work1
Oct 26 2015 22:19
well, I remember the thread, but I thought they ened up seeing conflating functions was a bad idea.
Scott Christopher
@scott-christopher
Oct 26 2015 22:20
nope
joneshf-work1
@joneshf-work1
Oct 26 2015 22:20
:(
ah well. Guess I'll stick to not using promises/a+ stuff.
thanks @scott-christopher
Scott Christopher
@scott-christopher
Oct 26 2015 22:22
No probs.
The eagerness of Promises aside, I haven't actually found the overloading of then to be much of a problem.
I would appreaciate the cleaner API, but I can't say I've ever had the need for mapping over a Future to return a Future (Future a)
It's mainly just the fact that they exist natively in a lot of places now that it makes them easy to use when I'm just throwing some script together quickly.
(read: I can be lazy)