These are chat archives for ramda/ramda

20th
Jul 2017
Adam Szaraniec
@mimol91
Jul 20 2017 05:17
Do you recommend any book/ videos which help you 'switch' mind to FP (I really like mostly-adequate-guide and Professor Frisby video)
Kurt Milam
@kurtmilam
Jul 20 2017 06:47
@mimol91 Functional Programming in JavaScript is a good resource.
Adam Szaraniec
@mimol91
Jul 20 2017 06:51
Thank you!
Adam Szaraniec
@mimol91
Jul 20 2017 07:00
It might be a stupid question, but is it possible to write medium complex web application only using FP? (and is it a good idea? or its better to mix oop with fp )?
Kurt Milam
@kurtmilam
Jul 20 2017 07:39
It's possible and not a bad idea. You can mix some oop in and still remain functional if all of your functions and methods are pure and you don't mutate anything.
So, rather than having thing.method modify thing, you'd have it return a new thing with the new values.
Adam Szaraniec
@mimol91
Jul 20 2017 10:23
but fp isnt only about mutating I guess. For me its more about being explicit, saying what not to how to do. You can sum up array using simple for each with some variable (all wrapped in some function - and its oop, FP will use reduce). There is a lot of use cases where having state is much simpler/readable(imho) - but it is in opposite to FP, am I right? Can you have 'real state' in FP ?
or you always need to assume that all what you need to do is a map
James
@aretecode
Jul 20 2017 10:28
@mimol91 it's a thing people have strong opinions on both ways :-P
Kurt Milam
@kurtmilam
Jul 20 2017 10:29
If you want to look into functional ways of dealing with state, calmm-js may be of interest to you. There's a gitter for calmm, as well.
calmm is a toolkit that includes Ramda, partial.lenses, Kefir (stream library), React and some handy utilities that make it relatively easy to write applications in Functional Reactive style.
Kurt Milam
@kurtmilam
Jul 20 2017 10:34
The (super shortened) gist of calmm is that you have a single, global source of truth in an observable atom. Any component depending on some part of the state atom will be automatically and immediately notified of changes to the part of the state it depends on.
Adam Szaraniec
@mimol91
Jul 20 2017 10:34
I am just beginner (I think it will be hard to go stright to calmm), but I start to loving FP after digging into ramda, but there is a lot of other stuff.
isnt it like redux concept?
Kurt Milam
@kurtmilam
Jul 20 2017 10:35
Parts of it are similar to redux, but other parts are much better. Calmm also enables you to directly embed observables into vdom, which does away with a lot of the boilerplate required by redux.
James
@aretecode
Jul 20 2017 10:35
in the way that it is "state", but if you can use redux I wouldn't see calmm being harder, since redux is so much more verbose
I think lense is pretty cool, you get the best of all worlds, similar to a Specification in DDD, dot-prop access, all the functional utils for getting and setting and observing
Kurt Milam
@kurtmilam
Jul 20 2017 10:37
Lenses (created via partial.lenses, which I recommend looking at even if you don't go 100% calmm) and Kefir's combine make it easy to slice up and recombine state such that any one component only has access to the state it needs, rather than having access to the entire global state.
James
@aretecode
Jul 20 2017 10:38
with that being said, sometimes there is a use for Value Objects, and sometimes I need by-reference and everything-pure-and-immutable is not the goal, as much as it pains some who do some incredible work with the "proper" ways to do things
Kurt Milam
@kurtmilam
Jul 20 2017 10:38
combine also allows the creation of dependent observables that can be embedded directly in vdom.
Adam Szaraniec
@mimol91
Jul 20 2017 10:39
I've recently start to leaning this Maybe concept, it is so great.
Kurt Milam
@kurtmilam
Jul 20 2017 10:39
Maybe and Either are two tools I am just starting to add to my toolchest.
Adam Szaraniec
@mimol91
Jul 20 2017 10:40
in a nutshell what are differences between kefir and Rx?
Kurt Milam
@kurtmilam
Jul 20 2017 10:42
I'm not an expert with either, but I believe it's safe to say that Rx offers much lower-level abstractions than Kefir.
In other words, Rx has the low-level tools that you could use to build something like Kefir.
Adam Szaraniec
@mimol91
Jul 20 2017 10:43
Thanks.
Kurt Milam
@kurtmilam
Jul 20 2017 10:43
But it seems (again, not being an expert) that the level of abstraction offered by Kefir is a useful one, saving you from having to reinvent the wheel with low-level tools.
As a metaphor, if you were looking to construct a house, Rx might be nails and boards whereas Kefir might be prefabricated walls.
Pygmalion
@PygmalionPolymorph
Jul 20 2017 11:10
I am currently working on a state management library which builds upon streams and lenses just in the fashion of calmm js but without the cognitive load you first have to overcome when just starting out with it. (New vocabulary like atoms, lensedatom, abstract mutable...) I'd be happy about any feedback since it's my first project published. :)
Also, it currently has no bindings to React and was built with mithril js in mind, but that's a field im working on currently
Kurt Milam
@kurtmilam
Jul 20 2017 11:20
@murmox I started playing around with a similar idea (also with mithril in mind) but abandoned it in favor of calmm. I'll keep an eye on kaleido.
Pygmalion
@PygmalionPolymorph
Jul 20 2017 11:22
@kurtmilam That's pretty cool! Maybe we'll have some synergies. :+1:
Kurt Milam
@kurtmilam
Jul 20 2017 11:23
Feel free to scavenge anything you find useful. I haven't touched it in a while and probably won't since I'm trying to grok calmm. :)
Unfortunately, the demo is broken. I'll see if I can get it running again.
Pygmalion
@PygmalionPolymorph
Jul 20 2017 11:25
Alright :) A demo for Kaleido is WIP currently
James Forbes
@JAForbes
Jul 20 2017 13:33
Beginner friendly intro to monads: http://james-forbes.com/?/posts/intro-to-monads
James Forbes
@JAForbes
Jul 20 2017 13:40
Ha that's great
Michael Rosata
@mrosata
Jul 20 2017 13:40
@JAForbes Well, it's no more or less confusing than any other intro to monads. It discusses burritos, so that's a plus
James Forbes
@JAForbes
Jul 20 2017 13:40
Yeah burritos are imperative
Michael Rosata
@mrosata
Jul 20 2017 13:40
wait, are they? Or are they functional?
James Forbes
@JAForbes
Jul 20 2017 13:40
mind blown!
Michael Rosata
@mrosata
Jul 20 2017 13:40
boom!
James Forbes
@JAForbes
Jul 20 2017 13:41
:D
Denis Stoyanov
@xgrommx
Jul 20 2017 15:01
not good book
Gabe Johnson
@gabejohnson
Jul 20 2017 15:02
I disagree
Denis Stoyanov
@xgrommx
Jul 20 2017 15:04
:point_up: July 20, 2017 9:47 AM @gabejohnson better choice
Gabe Johnson
@gabejohnson
Jul 20 2017 15:05
I've read it. It's pretty good
I think Allonge is a better read overall. It has a decidedly functional bias, but doesn't shun the use of objects and constructors
It's not an FP book, but a JS book with a lot of FP
Julien Bonnin
@JulienBonnin-ABTasty
Jul 20 2017 15:09
@JAForbes I'm sad, I don't get monads and when I was reading your article I was more and more confused :scream: It felt like watching Inception for the first time again (but I guess that was the point) Monads are useless to learn ?
Gabe Johnson
@gabejohnson
Jul 20 2017 15:16
At the risk of sounding like an authority (which I most certainly am not), monads are a tool that allows sequential computation where an operation relies on the result of a previous one while maintaining purity
I wouldn't get hung up on understanding the math or category theory
Someone feel free to correct any mistakes
Julien Bonnin
@JulienBonnin-ABTasty
Jul 20 2017 15:18
ah ok, so basically everything in Ramda is Monad ?
Gabe Johnson
@gabejohnson
Jul 20 2017 15:18
No
Well, what do you mean by "everything"?
Julien Bonnin
@JulienBonnin-ABTasty
Jul 20 2017 15:18
R.pipe for example ?
Gabe Johnson
@gabejohnson
Jul 20 2017 15:18
Do you mean the data types?
R.pipe is a function used for composition of Semigroupoids (the most familiar of which is Function)
Julien Bonnin
@JulienBonnin-ABTasty
Jul 20 2017 15:19
every step of the pipe relies on the output of the previous operation
James Forbes
@JAForbes
Jul 20 2017 15:21
sorry @JulienBonnin-ABTasty, I probably should have been less misleading. You can definitely learn monads. Just blog posts explaining what Monads are, are famously useless :D
Gabe Johnson
@gabejohnson
Jul 20 2017 15:21
R.pipeK works on monads. I'm trying to come up w/ a better explaination
James Forbes
@JAForbes
Jul 20 2017 15:23
I did write a serious blog post demonstrating the usefulness of fantasy land without explicitly mentioning Monads, and it seems to have helped a lot of people. Might be worth a read: @JulienBonnin-ABTasty http://james-forbes.com/?/posts/the-perfect-api
I feel really bad now :D
Julien Bonnin
@JulienBonnin-ABTasty
Jul 20 2017 15:25
Thank you both :) I have to say I am using ramda every day, but when I tried learning the algebraic types from https://github.com/fantasyland/fantasy-land( just en example) my brain started to melt. I am going to read that, thank you :)
James Forbes
@JAForbes
Jul 20 2017 15:27
I definitely empathize :D
Gabe Johnson
@gabejohnson
Jul 20 2017 15:28
@JulienBonnin-ABTasty @i-am-tom has a good blog series on FL starting http://www.tomharding.me/2017/03/03/fantas-eel-and-specification/
Julien Bonnin
@JulienBonnin-ABTasty
Jul 20 2017 15:29
ok, I know what to do now !
Gabe Johnson
@gabejohnson
Jul 20 2017 15:31
If you understand how to use Promise you're a long way toward understanding how to use monads in general
Michael Rosata
@mrosata
Jul 20 2017 15:31
@JulienBonnin-ABTasty @gabejohnson in that article, make sure to use v0.0.1 of Daggy, otherwise the examples won't run. Coincidentally I just figured that out a couple hours ago
Gabe Johnson
@gabejohnson
Jul 20 2017 15:50
:point_up:
@i-am-tom you got some free time to update those examples? :wink:
Kurt Milam
@kurtmilam
Jul 20 2017 16:00
@gabejohnson @i-am-tom I've enjoyed the issues of the series that I have read, so far. One nit to pick: It would be super nice if every article had links to previous and next articles in the series and/or if there were a single page with links to all of the articles in the series. As it is, unless I've overlooked something, it's not super easy to get from, say, article # x to article # 1, then work your way through the series in chronological order.
Gabe Johnson
@gabejohnson
Jul 20 2017 16:01
@kurtmilam you can do that from the homepage
Of course they're listed in reverse
Michael Rosata
@mrosata
Jul 20 2017 16:02
That's actually a good point, I had that page open on my browser for a good amount of time. By the end of reading it I forgot it was part of a series
until, as @gabejohnson points out I found myself at the homepage
Kurt Milam
@kurtmilam
Jul 20 2017 16:05
@gabejohnson Yeah, I was interested enough in them to go to those almost insurmountable lengths ;) , but making the navigation easier would probably lead to more people getting the whole message.
Previous, Next and Series Index links on every article in the series would be nice.
Gabe Johnson
@gabejohnson
Jul 20 2017 16:35
@kurtmilam agreed. Don't know the limitations of his platform. Don't know his platform
Kurt Milam
@kurtmilam
Jul 20 2017 17:03
:thumbsup:
Rick Medina
@rickmed
Jul 20 2017 17:10
that @i-am-tom 's series is the best
Rick Medina
@rickmed
Jul 20 2017 17:23
@JAForbes that magicreadalong conversation :joy: