by kortex · 6y ago · 0 comments
> We can think of a functor as a container, which contains one type of item. ... > A pointer: *T is a container that may be empty or contain one item;
Despite that comparison probably making seasoned FPers groan, that was a big clicking moment for me.
Thinking along the lines of nullary-function:pointer::return:dereference, frames Linus' abstraction in an interesting light. You're manipulating the "function which yields the struct", not the struct itself. In fact it looks much closer to a map than the cs101 blurb in that now all nodes can be treated symmetrically.
[0] - https://awalterschulze.github.io/blog/post/monads-for-goprog...
No comments yet.