purescript/purescript-enums

Overlapping instances found

rubenmoor opened this issue · 24 comments

Is the problem just this, or are my dependencies messed up?

Compiling Data.Enum
Error found:
Error in module Data.Enum:
Error in value declaration enumChar:
Error at /home/ruben/code/holger/hermit/bower_components/purescript-enums/src/Data/Enum.purs line 113, column 1 - line 121, column 1:
Overlapping instances found for Prelude.Bounded Prim.Char:
Data.Char.boundedChar
Prelude.boundedChar

It's not your fault, but yeah the dependencies are messed up - the Data.Char.boundedChar is an orphan instance, so we removed it from there and added it to Prelude (also it was incorrect). The prelude version was bumped as a patch release, but the update to strings was a breaking change release, but we've also updated everything in core that depended on strings so hopefully you should be able to update your dependency versions and everything should work out...

@paf31 looks like you were right though, maybe we should have bumped Prelude after all 😢 I'm not sure why the orphan instance error is appearing here when it seemed not to when I tested compiling new strings with the old prelude.

Does this happen after enums is updated?

But does it? 😄

Not for me 😉 - I ran the post-travis-test-everything locally after updating the libraries.

Maybe a cache issue then?

I ran

$ bower cache clean
$ bower update

Still got the issue upon compiling.

bower update won't update to the new version automatically as the new version is incompatible with the old - you'll need to update your purescript-enums dependency to ^0.7.0 (or whatever it is that is pulling purescript-enums in).

oh sure. Unfortunately, i end up with purescript-enums 0.5.0 automatically. My dep tree looks like this

purescript-node-fs 0.7.1 (or master)
    requires purescript-datetime 0.6.0
        requires purescript-enums 0.5.0

Adding

"purescript-enums": "^0.7.0"

to dependencies results in conflicts for bower update and quite regardless of my choice I run into the overlapping instances error. And adding the 0.7.0 to resolutions does nothing (not even a conflict during bower update)

Ahh ok! I'll update purescript-node-fs. I forgot about the projects in purescript-node.

If you bump your purescript-node-fs to v0.8.0 it should work out now, hopefully.

Now I run into issues with my other dependencies:

Unable to find a suitable version for purescript-foreign, please choose one:
1) purescript-foreign#^0.5.0 which resolved to 0.5.1 and is required by purescript-affjax#0.4.0, purescript-halogen#0ed8df5900
2) purescript-foreign#^0.7.0 which resolved to 0.7.0 and is required by purescript-node-fs#0.8.0

I'll keep trying. Is there a standard way to resolve this?

If I'm not mistaken, this is rather hopeless, or at least I lack overview on why and how packages depend on the older versions of purescript-strings and I am not able to resolve my issue by trying out different combinations.

Unable to find a suitable version for purescript-strings, please choose one:
1) purescript-strings#^0.5.0 which resolved to 0.5.5 and is required by purescript-enums#0.5.0, purescript-simple-dom#0.1.0, purescript-string-parsers#03d8277615
2) purescript-strings#~0.5.3 which resolved to 0.5.5 and is required by purescript-argonaut-codecs#0.1.0, purescript-foreign#0.5.1
3) purescript-strings#^0.5.2 which resolved to 0.5.5 and is required by purescript-css#150ae110d3
4) purescript-strings#^0.7.0 which resolved to 0.7.0 and is required by purescript-enums#0.7.0, purescript-foreign#0.7.0

Any idea for a workaround?

Ok, for the time being as an alternative, what happens if you stick to your original set of dependencies but add "purescript-prelude": "0.1.1"? This should prevent bower from pulling in v0.1.2 of the prelude which has the new instance in it.

In the long run all the stuff you're depending on will need updating anyway, as the old version of purescript-strings will not work with the most recent compiler release (v0.7.3, released yesterday). Some of them I'm responsible for anyway - namely affjax and halogen, so they will be updated in the near future.

That works for me. Thanks!

Great, sorry you had such trouble with it!

For some reason that fix doesn't work for me. I have purescript-prelude#0.1.1 in my bower.json, grep -r "Enum Char" bower_components/* and grep -r "Bounded Char" bower_components/* only give me a single instance each. I've removed bower_componenets/ and done bower cache clean many times, can't seem to get around it.

@Thimoteus purescript-strings pre-v0.7.0 combined with purescript-prelude v0.1.2 is the "real" culprit here, so if you have the older strings as a dependency that's where the issue will be coming from.

I added purescript-strings#0.7.0 as a dependency but the problem persists. I'm out of ideas, shouldn't it not happen if I have purescript-strings before 0.7.0 and purescript-prelude 0.1.1?

Oh, sorry, yep, prelude v0.1.1 should be fine with any version of strings.

What do you get from bower list after installing now?

:(

Did you try removing the output folder as well before compiling?

Ahh, that worked. I always forget about the output folder ...

thanks!