Closed joshua-obritsch closed 2 years ago
Haskell generally avoids this type of disambiguation, which in my opinion is a good thing. Compilers need to stay out of the business of resolving ambiguity. I just specify the type as you have here.
Yes. Although the error message is quite verbose you can interpret it as "The code could potentially do different things depending on what the type is." So giving it the exact type is the right way to go. I'll close, please reopen if you have further questions :)
Calling the following code in the repl:
Results in the following error message:
If I annotate the type as suggested like this:
background (inherit :: Color)
, then I get the expected output.I'm wondering if there is a language extension that would help Haskell infer a/any type or a way of defaulting so that these explicit type annotations would become unnecessary.