Live data from Hacker News

Learn Functional Programming Design from Redux

pitayan.com

21–30 of 48 posts

Re: Learn Functional Programming Design from Redux

#21
post #7

IMO Redux is a terrible way to start learning functional programming. There is too much boilerplate code and other code (ie. reducer, selectors, side effects, react components) that will confuse beginners and make the goal of learning functional programming harder. It's like telling someone who wants to learn to drive, here's the road laws book, car manual, car service manual, offroad rally driving guide and engine t…

Yup. Just use hooks.

Re: Learn Functional Programming Design from Redux

#22
post #20

Earlier quoted context omitted.

The Haskell snippet included is basically gibberish. It’s best to ignore it.

Has it been removed? I don't see any Haskell in the article.

Looks like it has been removed, yes.

Re: Learn Functional Programming Design from Redux

#23

In my experience learning, teaching, and watching other people learn FP, it's far easier to learn FP with a language which is actually designed for it, e.g. , Elm. JavaScript isn't that. It carries too much legacy baggage. Too many gotchas; too many pointy bits. It's also just super noisy. There's a reason why someone had to write The Good Parts . I don't buy the idea either that modern JavaScript is somehow devoid o…

Hey yakshaving, Osiris and others who agree with the sentiment of learning FP via Elm. Do you know of any good resources to start out with?

Re: Learn Functional Programming Design from Redux

#24

In my experience learning, teaching, and watching other people learn FP, it's far easier to learn FP with a language which is actually designed for it, e.g. , Elm. JavaScript isn't that. It carries too much legacy baggage. Too many gotchas; too many pointy bits. It's also just super noisy. There's a reason why someone had to write The Good Parts . I don't buy the idea either that modern JavaScript is somehow devoid o…

Are you implying that const _doesn’t_ give you an immutable value? Or are you purposefully ignoring the difference between a primitive value and a pointer to make your point?

The `const` keyword in JavaScript does not give you an immutable value. This is not up for discussion.

https://dev.to/valentinogagliardi/once-and-for-all-const-in-...

Re: Learn Functional Programming Design from Redux

#25

In my experience learning, teaching, and watching other people learn FP, it's far easier to learn FP with a language which is actually designed for it, e.g. , Elm. JavaScript isn't that. It carries too much legacy baggage. Too many gotchas; too many pointy bits. It's also just super noisy. There's a reason why someone had to write The Good Parts . I don't buy the idea either that modern JavaScript is somehow devoid o…

Hey yakshaving, Osiris and others who agree with the sentiment of learning FP via Elm. Do you know of any good resources to start out with?

The official guide is very clear and easy to follow[0].

[0]: https://guide.elm-lang.org/

Re: Learn Functional Programming Design from Redux

#26

Earlier quoted context omitted.

Are you implying that const _doesn’t_ give you an immutable value? Or are you purposefully ignoring the difference between a primitive value and a pointer to make your point?

The `const` keyword in JavaScript does not give you an immutable value. This is not up for discussion. https://dev.to/valentinogagliardi/once-and-for-all-const-in-...

const value can be redeclared in a different scope - but to be very precise; this is not really question of (im)mutability - it is a different value inside a scope, the original value is not changed.

Other thing is (and I believe this is what the OP is asking you) - if you say:

const a = 1;

a will always be 1 (inside the scope).

Sure if you say:

const o = { a: 1};

you can change the value of a inside the o, but the o (the pointer as the OP is saying) is not changed. I have 0 experience with Elm, but a _lot_ of popular languages have this behaviour for const/final

Re: Learn Functional Programming Design from Redux

#27

Earlier quoted context omitted.

Are you implying that const _doesn’t_ give you an immutable value? Or are you purposefully ignoring the difference between a primitive value and a pointer to make your point?

The `const` keyword in JavaScript does not give you an immutable value. This is not up for discussion. https://dev.to/valentinogagliardi/once-and-for-all-const-in-...

"[W]hen we say "const cannot be reassigned, nor re-declared" that does not mean const is immutable."

Perhaps this would be clearer: "The identity of a const object is immutable but its state can be mutable."

Re: Learn Functional Programming Design from Redux

#28
post #20

Earlier quoted context omitted.

The Haskell snippet included is basically gibberish. It’s best to ignore it.

Has it been removed? I don't see any Haskell in the article.

It's still there as far as I can see, it's in an image[0]. I believe their intention is to show a kind of pseudo-desugaring of what the IO monad actually does internally.

[0] -- https://pitayan.com/assets/static/haskell.cbab2cf.82d9f5b091...

Re: Learn Functional Programming Design from Redux

#29
post #26

Earlier quoted context omitted.

The `const` keyword in JavaScript does not give you an immutable value. This is not up for discussion. https://dev.to/valentinogagliardi/once-and-for-all-const-in-...

const value can be redeclared in a different scope - but to be very precise; this is not really question of (im)mutability - it is a different value inside a scope, the original value is not changed. Other thing is (and I believe this is what the OP is asking you) - if you say: const a = 1; a will always be 1 (inside the scope). Sure if you say: const o = { a: 1}; you can change the value of a inside the o, but the o…

It's not useful to describe the behaviour of "pointers" in JavaScript, because JavaScript does not have pointers[0].

I think the article I linked to earlier was already sufficiently unambiguous. To clarify once again: If you can mutate a value, then the value is mutable. Mutable means it is not immutable. The `const` keyword in JavaScript does not give you an immutable value.

[0]: https://stackoverflow.com/a/17382443/704015

Re: Learn Functional Programming Design from Redux

#30
post #28
post #20

Earlier quoted context omitted.

Has it been removed? I don't see any Haskell in the article.

It's still there as far as I can see, it's in an image[0]. I believe their intention is to show a kind of pseudo-desugaring of what the IO monad actually does internally. [0] -- https://pitayan.com/assets/static/haskell.cbab2cf.82d9f5b091...

Ah yes, just goes to show I ignore images in articles!
Post reply on HN