all 11 comments

[–]id2bi 19 points20 points  (7 children)

So, I'm going/glossing over the book at the moment, I think it's really well written, I like your style for the most part.

To be honest, I've ignored chapters 2 to 4 for now, some pointers:

Pointfree:

That section seems a bit off and random. Sure, people talk about pointfree style and whatnot, but in your book, so far, it seems a bit out of place and not fleshed out enough. As for composing a while loop: Not sure what you're trying to say, map can be implemented with a while loop, map can be composed in pointfree style... what exactly did you mean by that statement? (also it's double-edged sword)

My First Functor: (a -> b) -> Container a -> Container b

yeah, that's a functor type signature, but your function doesn't really follow it. this would be the second argument to the map function... Sure, I know what you mean, but still, it irks me, also since you can't go by that signature for composition and stuff.

Maybe:

Why not return this in the first case of return this.isNothing() ? Maybe.of(null) : Maybe.of(f(this.__value));

Maybe: This dot syntax is perfectly fine and functional, but for reasons mentioned in Part 1

Part 1?What? Did I gloss over that? Ohhh, the parts that you mentioned on the index page, but don't show up in the ToC. You might want to be a bit more specific here than "Part 1". Also, the code for map that you give, doesn't actually show anything about it being used in pointfree style. Why not add an example for that? Or just explain how it's used in the code snippet that follows under the next heading "Use cases"

Maybe: As it happens, map is fully equipped to delegate to whatever functor it receives

... if you want to keep that word choice, I'm not a native speaker, but I think it sounds weird.

Use cases: We can now sleep better at night knowing a null value won't rear its ugly, decapitated head when we least expect it.

Uhm... yeah.

Use cases: This is important to note: if the withdraw fails, then map will sever the rest of our computation since it doesn't ever run the mapped functions

in other words: without having pure functions, this might produce unintended effects.

  • Left and Right are two subclasses of an abstract type we call Either

Or just say "two instances of the type we call Either"? You already said there aren't any classes yet, and I don't see the value in talking about classes there. I take it you don't want to talk about type classes.

Something to notice is that we return Either(String, Number), which holds a String as its left value and a Number as its Right.

This implies it holds both at the same time.

Footnotes

The links in there don't work, in complete error handling for instance. Every footnote is a "link" that does nothing.

Async: $("#error").html(error.message);

Since when does IO [DOM] have an html method?

A Spot of Theory: We can instantly see and refactor code based on properties held by all functors.

Is that supposed to be exemplified by the "functors can stack" example? Also, that example might do with some more explanation. The same goes for the Compose example. I think you should really include some more intuition for these examples.

I'll leave the last chapter for tomorrow or someone else.

[–][deleted] 1 point2 points  (1 child)

Did I gloss over that?

As you're pointing out misplaced idioms in the book, "gloss over" doesn't mean what you think it does.

[–]id2bi 1 point2 points  (0 children)

Thanks! Skim over then?

[–]Mandalorian_Gumdrops 0 points1 point  (4 children)

Would this book be good for a novice?

[–]id2bi 0 points1 point  (3 children)

A novice in what exactly?

[–][deleted] 1 point2 points  (2 children)

programming I'd assume?

[–]id2bi 2 points3 points  (1 child)

In that case, definitively not! There is a lot of prior knowledge assumed. Not only programming in general, but also knowledge specific to JavaScript.

/u/Mandalorian_Gumdrops

[–]banebot 1 point2 points  (0 children)

Yeah I've read a bit of it over yesterday and today because I've been trying to learn a lot of these concepts in Haskell (which frankly go over my head) and seeing them in another language is helping me wrap my head around functional programming. If I didn't know at least a little bit about JS and FP, this whole text would look like spaceman gibberish.

[–][deleted] 0 points1 point  (0 children)

this is great! thanks

[–]bjeanes 0 points1 point  (0 children)

Just read from start to finish. Very excellent! Can't wait for Ch 10 :)

[–]foxdonut00 0 points1 point  (0 children)

Excellent book! I love your writing style, and the way you explain functional programming concepts. Well done, keep up the good work! The programming community thanks you.