getify / Functional-Light-JS

Pragmatic, balanced FP in JavaScript. @FLJSBook on twitter.
http://FLJSBook.com
Other
16.64k stars 1.96k forks source link

Tech Edit: Chapter 7 #70

Closed DrBoolean closed 7 years ago

DrBoolean commented 7 years ago

There is some brilliant stuff in this chapter. I really like the church encodings in stuff like trackEvent which gives an intuition for how the state monad works.

The summary is so damn good. Just some corrections on the isomorphic stuff:

But "maintain the same behavior" is a little off - usually that's precisely the point e.g. Array<Char> is isomorphic to String, but they have different behavior. I'd say "maintain the same information".

Also, we usually we say "X is isomorphic /to/ Y" :)

That's all it got! Great chapter.

getify commented 7 years ago

Would it be more accurate to say "maintain the same capability" or "maintain the same outcome"?

DrBoolean commented 7 years ago

Well, I think the main use case of an isomorphism in FP is to make a type conversion to get new behavior, then convert it back after. So like a linked list can turn into an array to gain some operation, then back afterward. Or a multi-dimensional array can turn into a rose tree and back. Things like that.

So "holds same information" captures the use a little better than "has same capability" even though that makes sense as well.