<p dir="ltr">Whoa. I was far too confident that wouldn't work!</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 2, 2016 12:39 PM, "Richard Eisenberg" <<a href="mailto:rae@cs.brynmawr.edu">rae@cs.brynmawr.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>I feel like I must be missing something, but what's wrong with</div><div><br></div><div><div></div></div><blockquote type="cite"><div><div>class Semigroup1 f where</div><div>  op :: f a -> f a -> f a</div><div><br></div><div>  default op :: Monoid (f a) => f a -> f a -> f a</div><div>  op = (<>)</div></div></blockquote><div><br></div><div>? Does that do what you like?</div><div><br></div><div>Richard</div><div><br></div><br><div><blockquote type="cite"><div>On Sep 1, 2016, at 11:15 PM, David Feuer <<a href="mailto:david.feuer@gmail.com" target="_blank">david.feuer@gmail.com</a>> wrote:</div><br><div><p dir="ltr">On occasion, it can be useful to have default definitions that don't typecheck even with DefaultSignatures. It would be nice to be able to use them anyway. For example, if we have</p><p dir="ltr">class Semigroup1 f where<br>
  op :: f a -> f a -> f a</p><p dir="ltr">then we could, hypothetically, give a default definition for (<>):</p><p dir="ltr">  default (<>) :: Semigroup1 f => f a -> f a -> f a<br>
  (<>) = op</p><p dir="ltr">But we can't give a default definition</p><p dir="ltr">  op = (<>)</p><p dir="ltr">because there's no way to write its signature. However, for any F with</p><p dir="ltr">instance Semigroup (F a) where ...</p><p dir="ltr">the definition op = (<>) is perfectly fine.</p><p dir="ltr">Would it be possible to offer a completely wild defaulting mechanism allowing *any expression* as a default, and only checking its type and compiling it when it's actually used?</p>
______________________________<wbr>_________________<br>ghc-devs mailing list<br><a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br><a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/ghc-devs</a><br></div></blockquote></div><br></div></blockquote></div></div>