... | ... | @@ -9,11 +9,11 @@ It has recently been highlighted that as these changes affect the Prelude, and t |
|
|
|
|
|
However, there are many good reasons to do both the AMP and FTP generalizations at this time.
|
|
|
|
|
|
- By generalizing the `Prelude`, the `Prelude` will no longer cause name collisions anywhere within `base`. This is a very simple rule to state; it is a very simple rule to understand.
|
|
|
- **By generalizing the `Prelude`, the `Prelude` will no longer cause name collisions anywhere within `base`**. This is a very simple rule to state; it is a very simple rule to understand. This is no panacea, other packages can and do still export combinators that collide with `Prelude`, but it means that simple things like explaining how `traverse` relates to `mapM` in `ghci` will no longer invite a comedy of errors and name conflicts.
|
|
|
|
|
|
- `Foldable` and `Traversable` are abstractions that have seen long use in the Haskell community, predating even the existence of `Applicative`, dating back into the early 2000s. We know and have tested these abstractions, and they have deep explanatory power.
|
|
|
|
|
|
- `Traversable` in particular has given us insight into the nature of finitary traversals and have been the subject of many papers since Jeremy Gibbons wrote [ The Essence of the Iterator Pattern](http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf) each of which has managed to narrow the set of laws until we're left with only the obvious generalization of the `Functor` laws that allows for `Applicative` effects. \[[ Investigation of the Laws of Traversals"](http://arxiv.org/pdf/1202.2919v1.pdf|"An) is one such paper, providing the common sense reading of the `Traversable` laws.
|
|
|
- `Traversable` in particular has given us insight into the nature of finitary traversals and have been the subject of many papers since Jeremy Gibbons wrote [ The Essence of the Iterator Pattern](http://www.cs.ox.ac.uk/jeremy.gibbons/publications/iterator.pdf) each of which has managed to narrow the set of laws until we're left with only the obvious generalization of the `Functor` laws that allows for `Applicative` effects. [ An Investigation of the Laws of Traversals](http://arxiv.org/pdf/1202.2919v1.pdf) is one such paper, providing the common sense reading of the `Traversable` laws.
|
|
|
|
|
|
- However, `Traversable` is too strong a requirement for many of the operations it enables. `foldMap` is what you get when you limit the power of `traverse` to just consumption, so `Foldable` has a role in this hierarchy. It is particularly telling that almost all the interesting combinators enabled by `Traversable` are actually enabled by merely `Foldable` constraints, including some at-first-surprising results such as `traverse_`. `Foldable` shows us a fairly deep connection between 33+ seemingly unrelated operations from the `Prelude`. `Traversable` adds connections between several more to that mix.
|
|
|
|
... | ... | |