Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Go ahead and suppress this warning!</p> <p>You are in good company. Conal does it in "TypeCompose". "chp-mtl" and "chp-transformers" do it, "control-monad-exception-mtl" and "control-monad-exception-monadsfd" do it, etc.</p> <p>btw you probably already know this, but for those that don't and stumble your question on a search:</p> <pre><code>{-# OPTIONS_GHC -fno-warn-orphans #-} </code></pre> <p><strong>Edit:</strong></p> <p>I acknowledge the problems that Yitz mentioned in his answer as real problems. However I see not using orphaned instances as a problem as well, and I try to pick the "least of all evils", which is imho to prudently use orphan instances.</p> <p>I only used an exclamation-point in my short answer because your question shows that you are already well aware of the problems. Otherwise, I would have been less enthusiastic :)</p> <p><strong>A bit of a diversion, but what I believe is the perfect solution in a perfect world without compromise:</strong></p> <p>I believe that the problems Yitz mentions (not knowing which instance is picked) could be solved in a "holistic" programming system where:</p> <ul> <li>You are not editing mere text files primitively, but are rather assisted by the environment (for example code completion only suggest things of relevant types etc)</li> <li>The "lower level" language has no special support for type-classes, and instead function tables are passed along explicitly</li> <li>But, the "higher level" programming environment displays the code in similar way to how Haskell is presented now (you usually won't see the function tables passed along), and picks the explicit type-classes for you when they are obvious (for example all cases of Functor have only one choice) and when there are several examples (zipping list Applicative or list-monad Applicative, First/Last/lift maybe Monoid) it lets you choose which instance to use.</li> <li>In any case, even when the instance was picked for you automatically, the environment easily allows you to see which instance was used, with an easy interface (a hyperlink or hover interface or something)</li> </ul> <p><strong>Back from fantasy world (or hopefully the future), right now: I recommend trying to avoid orphan instances while still using them when you "really need" to</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload