ekmett / ekmett/adjunctions

Add FunctorWithIndex constraint to Representable?

Open
#31 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
45
Forks
26
PR merge metrics
No merged PRs in 30d

Description

```haskell
defaultimap ::
Representable f => (Rep f -> a -> b) -> f a -> f b
defaultimap f fa = tabulate (f <*> index fa)
```

proves that we can (modulo package issues) use

```haskell
class (FunctorWithIndex (Rep f) f, Distributive f) => Representable f where ...
```

The only potential downside (aside from package dep and compatibility issues) is that someone could theoretically use something other than `Rep f` as the index. This seems a bit unlikely, but not entirely impossible.

As for the packaging, I think it's *weird* that `XxxWithIndex` live in `lens`. Are the lensy defaults really worth tying these simple classes up with the behemoth?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.