-
Notifications
You must be signed in to change notification settings - Fork 29
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
Documentation and compiler errors #300
Comments
Yeah, the overlapping instance error is pretty terrible. Adding it to the documentation is definitely worthwhile, but I also wonder if GHC could deal with this better. Maybe I'll file a ticket on the GHC issue tracker. |
Or is it the sort of thing you can intercept with the TypeError machinery and produce a better error message? |
Does the new |
Custom type errors won't help here. Basically, there are two cases: xxx1 :: State Int :> es => Eff es ()
xxx1 = do
get
pure () here you get
this one I would say is not that bad, it explicitly tells you that the type parameter of But there's also this: xxx2 :: Eff '[State Int] ()
xxx2 = do
get
pure () and then you get
I think this is the main subject of complaint here, right? On the other hand, the error message is completely right, it can't pick the instance of |
Yes, the latter error is what I first found very opaque and then learned to basically just skim to find the type parameter ghc was finding ambiguous (usually the one with a number at the end!) and figure out how to make it less so. I don't think it's a problem once you get used to it, though it could obviously be simpler. But it's a little terrifying the first few times! Which is why I suggested documenting it, perhaps along with some hints for how to interpret the message and resolve the error. And yes, the IncoherentInstances bit adds to the confusion... |
I just migrated an mtl-style codebase to Effectful. It was largely straightforward and the codebase is better for it.
Since I was able to add multiple
State
effects instead of a single effect with a larger state, I did. But then I had various issues when usage of one of those states was ambiguous, indicated by an "Overlapping Instances" ghc error. I sorted them out, but it took me a while to catch on that the "Overlapping instances" error message was indicating that. I wonder if it would be worthwhile to add a section to the readme with some common confusing error messages and what they likely mean?The text was updated successfully, but these errors were encountered: