Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no Applicative for Forget a #103

Open
Icelandjack opened this issue Oct 26, 2022 · 2 comments
Open

There is no Applicative for Forget a #103

Icelandjack opened this issue Oct 26, 2022 · 2 comments

Comments

@Icelandjack
Copy link
Contributor

Applicative (Forget a) (and the rest of the instances) should be derived via Star (Const a)

@Icelandjack
Copy link
Contributor Author

Icelandjack commented Feb 22, 2024

I tried to add the following deriving statements¹ but it produces a cyclical import for Traversing and the other classes. Does it need a restructure, or should those instances not be added?

newtype Forget r a b = Forget { runForget :: a -> r }
  deriving (Profunctor, Choice, Cochoice, Strong, Traversing) -- Rep.Representable
  via Star (Const r)

  deriving (Functor, Applicative, Contravariant)
  via Star (Const r) a

¹ How best to derive Semigroup, Monoid

@RyanGlScott
Copy link
Collaborator

That's somewhat unfortunate, but it should still be possible to implement the instances by hand, right? (We could leave a comment next to these instances saying that "morally", they're what deriving via Star (Const r) would give you.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants