SAFE: a Foldable proposal
Kosyrev Serge
_deepfire at feelingofgreen.ru
Thu Feb 25 21:32:02 UTC 2016
Thomas Tuegel <ttuegel at gmail.com> writes:
>> And since Foldable is a superclass of Traversable, it rules out a good degree
>> of the things we want to be Traversable.
>
> This is a radical position, but I don't think we do want these things to be
> Traversable or Foldable. Let me explain.
>
>> For example, Set is a very good example of something we want to be
>> Foldable. But it can't be made an Alternative.
>
> Foldable implies a notion of structural direction through the associativity of
> its members. Set is different from the well-behaved Foldables because its notion
> of direction or order is not structural, i.e. not preserved by operations on
> Set.
>
>> Something we want to traverse often (and fold sometimes) is Map. Map is not
>> something that can be made an Alternative either.
>
> Because it is not Applicative? Yes. For the same reason as Set, though, I do not
> think it should be Foldable or Traversable. It is convenient, but unsound. Or at
> least, less-sound. To fold or traverse Set and Map, I think the sound thing to
> do is to use one of the provided functions to convert them to a type where
> ordering is reflected structurally.
What about adding unstructural fold/traversal under different names?
That way we could have the convenience when we truly don't care about
the directionality property, and the benefits of pure folding at the
same time.
--
с уважениeм / respectfully,
Косырев Сергей
More information about the Libraries
mailing list