Avoid polluting globals
Hey there! I think for the sake of simplicity, you extend the prototype of Array. To communicate best practices, I'd like to come up with examples that do not extend the global Array object.
The alternative, to create objects from scratch is also more real-world oriented.
Here is a list of examples that use prototype
Thank you.
While I agree, we'd have to either create our own List or some other type that implements all the relevant type classes. I have mixed feelings on whether that'd make it harder to understand
- if we choose to create List is the reader gonna ask "Why are you reimplementing array in a feature-poor way?"
- If we choose Maybe then it may be trying to teach too many ideas at once.
- If we choose Identity then it becomes hard to justify as valuable and stay terse.
Maybe defining everything in terms of static-land instead of fantasy-land would be better. https://github.com/fantasyland/static-land