Potential additional superclass of Traversing?
- Dominant language
- Haskell
- Stars
- 72
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
Something that's `Traversing` should perhaps be, in addition to being `Strong` and `Choice`, also something that represents being able to go over a fixed number of values. If there were some kind of numbered `Vec`, I could see it going something like this:
```haskell
class Profunctor p => TraversingFixed p where
traverseFixed :: KnownNat n => p a b -> p (Vec n a) (Vec n b)
```
The other way I could see it happening is by using the fact that a `Distributive` always has the same number of values in it, because it's isomorphic to `x -> a` for some `x`:
```haskell
class Profunctor p => TraversingFixed p where
traverseDist :: (Traversable f, Distributive f) => p a b -> p (f a) (f b)
```
I honestly have no idea how to convert the former to the latter, though, or what to do if the `f` to be traversed is infinite, because infinite traversals in Haskell *can* be meaningful. I'm also not entirely sure how a hypothetical `wander` analogue of `traverseFixed` would go, since the point of `Applicative` is that it can combine an arbitrary number of fixed effects.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the existing Traversing, Strong, Choice, and Distributive definitions and their laws. Compare the proposed fixed-size Vec and Distributive approaches, including the infinite-traversal question, before deciding whether a superclass is coherent. Done requires an agreed design and a concrete specification for the new abstraction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100