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

TH generates ambiguous smart constructors for phantom parameters #48

Closed
isovector opened this issue May 15, 2019 · 3 comments
Closed

TH generates ambiguous smart constructors for phantom parameters #48

isovector opened this issue May 15, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@isovector
Copy link
Member

The TH currently spits out smart constructors like this:

data Foo e m a where
  FooC :: Foo e m ()

fooC :: forall e r. Member (Foo e) r => Sem r ()
fooC = send FooC

Uh oh! The usage of FooC here is ambiguous! The plugin will correctly determine what it should be (send $ FooC @e), but it'd be nicer if the TH just did the right thing to begin with.

We want to generate this:

fooC :: forall e r. Member (Foo e) r => Sem r ()
fooC = send (FooC @e)
@isovector isovector added the bug Something isn't working label May 15, 2019
@googleson78
Copy link
Member

fooC :: forall e r. Member (Foo e) r => Sem r ()
fooC = send (FooC @e)

is also ambiguous? (according to ghc)

@isovector
Copy link
Member Author

It is, but differently ambiguous! The code as its written today is ambiguous in the effect its trying to send, but the correct code is only ambiguous in terms of AllowAmbiguousTypes :)

@isovector
Copy link
Member Author

Fixed by #67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants