agda-stdlib icon indicating copy to clipboard operation
agda-stdlib copied to clipboard

There should be level-polymorphic versions of the combinators in `Data.List.Categorical`

Open laMudri opened this issue 6 years ago • 8 comments

The definitions of RawFunctor, RawApplicative, &c, by necessity, make it so that their fields (like _<$>_) only work on functions between types at the same level. This means, for example, that the _⊛_ we get from applicative in Data.List.Categorical has type ∀ {ℓ} {A B : Set ℓ} → List (A → B) → List A → List B. However, it would be convenient to have a definition of _⊛_ somewhere with type ∀ {a b} {A : Set a} {B : Set b} → List (A → B) → List A → List B.

Probably these definitions should go in Data.List.Base, though this would probably break any code using the categorical combinators because of name clashes.

There are probably similar problems in all of the other Categorical modules, but I haven't had a look at them yet.

laMudri avatar Oct 18 '19 13:10 laMudri

Yep. See for instance the level polymorphic _>>=_ in Data.Maybe.Base.

gallais avatar Oct 18 '19 13:10 gallais

Another funny thing is that RawMonad is not a subclass of RawApplicative, so the _⊛_ coming from monad is different to the one coming from applicative. When I tried just using the definition from applicative, it broke some proofs.

laMudri avatar Oct 18 '19 15:10 laMudri

I'd argue that is a bug that we should definitely fix in version 2.0.

gallais avatar Oct 18 '19 15:10 gallais

I'd argue that is a bug that we should definitely fix in version 2.0.

@laMudri maybe open a new issue for it?

MatthewDaggitt avatar Oct 19 '19 01:10 MatthewDaggitt

#952

laMudri avatar Oct 19 '19 08:10 laMudri

If people are keen to include this in v1.2 as the milestone suggests, could someone open a PR in the next couple of days?

MatthewDaggitt avatar Oct 29 '19 13:10 MatthewDaggitt

It's easy enough to hand-code something, but that feels like cheating (and non-scalable). I do have a more level-polymorphic RawFunctor, but RawApplicative has resisted all my attempts at generalization.

JacquesCarette avatar Oct 29 '19 13:10 JacquesCarette

Harder than first thought. According to @JacquesCarette needs some level-function hackery. Bumping.

MatthewDaggitt avatar Sep 12 '22 16:09 MatthewDaggitt