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

Add role annotations to Behavior and Event #219

Open
ocharles opened this issue Sep 13, 2021 · 2 comments · May be fixed by #221
Open

Add role annotations to Behavior and Event #219

ocharles opened this issue Sep 13, 2021 · 2 comments · May be fixed by #221

Comments

@ocharles
Copy link
Collaborator

ocharles commented Sep 13, 2021

Currently these are inferred as nominal, but I think the parameter should be representational. This would let us say

newtype CheckboxEvent = CheckboxEvent { toEvent :: Event Bool }
  deriving (Monoid, Semigroup) via Event Any

which seems a perfectly reasonable thought.

@HeinrichApfelmus
Copy link
Owner

Huh. Based on a cursory understanding of type roles, I would also say that its role should be representational. However, I'm hesitant to change the role manually if the compile inferred nominal for a good reason — why did that happen? 🤔

@ocharles
Copy link
Collaborator Author

I think it happened because way down in what a Behavior actually is is something with a GADT or something that forces us to be nominal. This means we'll probably need to employ a trick to get this to be representational (usually I do this with a Coyoneda-like existential mapping function). I'll give this a shot and open up a PR!

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

Successfully merging a pull request may close this issue.

2 participants