These are chat archives for ramda/ramda

27th
Feb 2017
Keith Alexander
@kwijibo
Feb 27 2017 07:44
thanks @puffnfresh that's great. So do you get a type error if you do log $ example2 $ MyConfig { foo: "Hello" } (ie, you forget a key)?
Tycho Grouwstra
@tycho01
Feb 27 2017 08:22
Yeah, how is that partial.lenses library perceived here? Just started reading about it earlier.
Brian McKenna
@puffnfresh
Feb 27 2017 09:58
@kwijibo yes
that's a type error
Keith Alexander
@kwijibo
Feb 27 2017 09:58
very nice
Brian McKenna
@puffnfresh
Feb 27 2017 10:02
convenience with no downsides
JS is obsoleted, once again
Tycho Grouwstra
@tycho01
Feb 27 2017 10:28
@puffnfresh isn't it tougher to use Haskell if you are to do say front-end?
Brian McKenna
@puffnfresh
Feb 27 2017 10:28
the above is PureScript
Tycho Grouwstra
@tycho01
Feb 27 2017 10:28
oh, I see :)
Brian McKenna
@puffnfresh
Feb 27 2017 10:29
which is excellent at doing front ends, I've done it
Tycho Grouwstra
@tycho01
Feb 27 2017 10:29
interesting
Tycho Grouwstra
@tycho01
Feb 27 2017 10:33
I've been using Angular 2, but had been under the impression there's been so much going on within front-end frameworks I'm not so sure if these Elm/Haskell/PureScript alternatives have managed to get on par there, though getting Ramda to typecheck in TS has been haunting me for quite a bit. Disclaimer: I really don't have a full grasp on the comparison, guess there's quite a bit to consider and I haven't really seen quite enough of both sides of the fence.
Brian McKenna
@puffnfresh
Feb 27 2017 10:34
what would be involved in getting "on par?"
Tycho Grouwstra
@tycho01
Feb 27 2017 10:34
Yeah... good question.
Brian McKenna
@puffnfresh
Feb 27 2017 10:40
PureScript has FFI, so you can easily call into legacy JS stuff
Tycho Grouwstra
@tycho01
Feb 27 2017 10:55
(trying to go answer your question, but out of curiosity, would you still have used for Ramda in PureScript?)
Brian McKenna
@puffnfresh
Feb 27 2017 10:55
nope
Tycho Grouwstra
@tycho01
Feb 27 2017 10:55
ah, I see
Brian McKenna
@puffnfresh
Feb 27 2017 10:55
only transitively, if at all
Tycho Grouwstra
@tycho01
Feb 27 2017 10:56
so uh, what brings you here? :P
Brian McKenna
@puffnfresh
Feb 27 2017 10:56
I'm currently writing JS
Tycho Grouwstra
@tycho01
Feb 27 2017 11:34

I tried going over the documented parts of the Angular cheatsheet, API and repos in an attempt to get an overview of the concerns they're trying to address:

  • server-side rendering for SEO purposes
  • deploying to web, mobile (iOS/Android/...), Windows apps (Electron), browser extensions, ...
  • template variables
  • virtual dom to rerender only diffs, along with ways to let the user indicate what constitutes item identity in iterables to ensure as little as possible gets re-rendered
  • auto-memoize on functions marked as pure (pure Pipes in ng parlance)
  • some premade 'Pipes' for common ways to serialize info (currency, dates, ...)
  • templates not using weird jsx stuff so compatible with e.g. Pug to DRY up the html
  • dependency injection to make all parts customizable
  • 'directives' as rulesets to change behavior of elements
  • controlled communication among components in the hierarchy (ng parlance: inputs/outputs)
  • transcluding content into components (which is actually the norm in React though Angular normally delegates from the top down rather than injecting everything from the very top)
  • component lifecycle hooks (e.g. do x when your component is created/changed/initiated/rerendered/destroyed)
  • router: besides the obvious stuff supports lazily loaded routes, route authorization guards
  • ahead-of-time compilation to ensure only some 'bytecode' representation of the app (excl. Angular compiler) would be shipped to the client
  • i18n support, though useless (presumes compiling the text in rather than making it dynamic)
  • animation support (perhaps not unlike the PowerPoint crap, e.g. if you add an item to your list, have it materialize / fly in in such and such way in the UI)
  • change detection strategies ensuring bits only get updated once they change in the model (idiomatically using their redux-observable knockoff @ngrx/store), controlled way to quarantine side-effects, log/monitor/replay state changes for testing/debugging
  • support for asynchronously executing functions outside of the context of the front-end framework so the UI wouldn't hang (Zones, since made into a TC39 proposal). that's using webworkers, but Angular itself runs in one too for similar reasons.
  • sanitization of injected html/styles/images/scripts in the event of malicious user-injected content
  • performance monitoring thing (web tracing framework)
  • stuff for testing (e.g. separate components/whatevers, e2e), mocking backends
  • stuff mediating between the values in the model and UI controls (incl. custom ones), as well as validation rules
  • observable-based http module (for easy canceling, retrying, throttling, merging such as to ignore all but the latest search request), handling base headers, ...
  • CLI for scaffolding new projects/components/whatevers that'd help manage the build process for you (webpack config: how to load different file types, e.g. different preprocessors)
  • premade components in google's Material Design style (material2, teradata's covalent) that hook into the Angular model
  • browser plugins to inspect components / model state
  • language services for IDE completion including within the HTML views

I'm not gonna pretend the other players wouldn't have covered at least most of this as well, especially since there's no magical advantage these guys have. There's probably stuff I'm overlooking, but that said, I do know all in all there's a bunch of different concerns, and these guys have been pumping a bunch of resources into getting them covered...

Tycho Grouwstra
@tycho01
Feb 27 2017 11:51
Honestly the ecosystem frustrates me since FP support is very low on TypeScript's priority list, so I'd love to switch to a better solution, but yeah, with this list I'd have quite a few concerns to resolve before I safely could...
Vincent Orr
@Cmdv
Feb 27 2017 16:00
I have an array of objects: [{id: 1, data: ...},{id: 2, data: ...},{id: 3, data: ...}] how would I remove a whole object via matching one of it's key?
Brad Compton (he/him)
@Bradcomp
Feb 27 2017 16:10
@ram-bot
var arr = [{id: 1}, {id: 2}, {id: 3}];

reject(propEq('id', 3))(arr);
ram-bot
@ram-bot
Feb 27 2017 16:10
[ { id: 1 }, { id: 2 } ]
Vincent Orr
@Cmdv
Feb 27 2017 16:21
@Bradcomp Ramda has it all hehe thanks :+1:
Shawn Talbert
@ShawnTalbert
Feb 27 2017 21:10
can I declare a custom sequence with Ramda, like you can with LazyJS?
i.e. a sequence that is not a JS array - in my case I want to surface database search results as a stream that can be processed by ramda. Under the hood it will require paging the results from the database
Keith Alexander
@kwijibo
Feb 27 2017 23:01
@ShawnTalbert are you looking for loop fusion? (if so, transducers might be what you're looking for)