These are chat archives for ramda/ramda

28th
Feb 2017
Brian McKenna
@puffnfresh
Feb 28 2017 05:24
loop fusion usually comes for free from laziness, I think @ShawnTalbert wants to reuse functions (e.g. head) on a lazy list instead of strict array
Keith Alexander
@kwijibo
Feb 28 2017 16:23
Bit of a bikeshedding question to the room, but do you folks tend to import R from 'ramda' or import {map, pipe, filter, prop } from 'ramda'?
(or something else)
Brad Compton (he/him)
@Bradcomp
Feb 28 2017 16:27
I prefer the second one. Well, const {map, filter, reduce} = require('ramda')
Keith Alexander
@kwijibo
Feb 28 2017 16:32
any particular reason?
Brad Compton (he/him)
@Bradcomp
Feb 28 2017 16:36
R.filter(R.either(R.isNil, R.isEmpty))(stuff) starts to look pretty cluttered. The R. creates visual noise and obscures the functions you're calling
Keith Alexander
@kwijibo
Feb 28 2017 16:58
:+1:
OTOH the imported function list can get very long when Ramda exports so many functions if you use a lot of them, and can be a bit of a burden to maintain
Brad Compton (he/him)
@Bradcomp
Feb 28 2017 17:01
That's true. You end up with the entire Ramda API at the top of your file.
But at least the clutter is consolidated in one place instead of spread throughout your file.
Keith Alexander
@kwijibo
Feb 28 2017 17:02
IIRC someone had a vim plugin or something that would curate the import for you
Brad Compton (he/him)
@Bradcomp
Feb 28 2017 17:02
This is literally the file I'm working on right now:
const {
    any, append, chain, clone, compose, concat, defaultTo, equals,
    evolve, find, groupBy, head, map, merge, omit, path, pathOr,
    pick, prop, reduce, sort, zipWith
    } = require('ramda');
Keith Alexander
@kwijibo
Feb 28 2017 17:02
yeah, that's not even that bad :)
Travis LaDuke
@laduke
Feb 28 2017 21:00
<- just realized you can use destructuring to get import style... imports with require
Rick Medina
@rickmed
Feb 28 2017 21:27
I think there is a babel plugin somewhere that spares you from the explicit imports
Stefano Vozza
@svozza
Feb 28 2017 21:28
anyone else getting affected by the s3 outage?
it looks like that would spare you explicit imports if you are doing it to get tree shaking
but not if you are doing it to avoid the extra noise of the R namespace everywhere
Rick Medina
@rickmed
Feb 28 2017 21:32
@kwijibo that one. But doesn't work the way I thought. btw, tree shaking is impossible for ramda
Keith Alexander
@kwijibo
Feb 28 2017 21:33

hmmm the plugin claims to

remove unused ramda dependencies, without forcing the user to cherry pick methods manually

are you saying it won't work?

Rick Medina
@rickmed
Feb 28 2017 21:34
I mean, not writing R.fn as Brad wants to
Brad Compton (he/him)
@Bradcomp
Feb 28 2017 21:37
@svozza We are waiting on CircleCI to come back up :expressionless:
Brad Compton (he/him)
@Bradcomp
Feb 28 2017 22:04
@kwijibo @rickmed This? https://github.com/raine/ramda-destruct
Keith Alexander
@kwijibo
Feb 28 2017 22:15
:+1:
Rick Medina
@rickmed
Feb 28 2017 22:23
bookmarked!
Brad Compton (he/him)
@Bradcomp
Feb 28 2017 22:27
It's in the wiki :stuck_out_tongue: