<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Constraints aren't considered when instance selection is
      performed. I.e. you can't have both:<br>
      instance Foo a where ...<br>
      instance Show a => Foo a where ....<br>
    </p>
    <p>But you can use default method signatures:
<a class="moz-txt-link-freetext" href="https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#default-method-signatures">https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#default-method-signatures</a><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 29/06/2017 19:27, Jean Lopes wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAKeoKsh2RogDHp7h50hf6Lf11fn_iDnNT+1yyGOqfJb=K1naFg@mail.gmail.com">
      <div dir="auto">It appear more like Show, you can add a
         constraint to the generic instance
        <div dir="auto"><br>
        </div>
        <div dir="auto">instance Show a => Foo a where</div>
        <div dir="auto">    bar x = show x<br>
          <div dir="auto"><br>
          </div>
          <div dir="auto"><br>
          </div>
          <div dir="auto"><br>
          </div>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">Em 29 de jun de 2017 2:16 PM, "Silent
          Leaf" <<a href="mailto:silent.leaf0@gmail.com"
            moz-do-not-send="true">silent.leaf0@gmail.com</a>>
          escreveu:<br type="attribution">
          <blockquote class="quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">hi,
              <div><br>
              </div>
              <div>say i have the following typeclass:</div>
              <div><br>
              </div>
              <div>class Foo a where</div>
              <div>  bar :: a  -> String</div>
              <div><br>
              </div>
              <div>looks a lot like the Read typeclass, right? (at least
                i think it should?)</div>
              <div>well say it's a different meaning (in other terms i
                can't or do not want to use Read, but i'd like to
                implement a default version of bar for those instances
                that also implement Read. is there a way to do so?</div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            Beginners mailing list<br>
            <a href="mailto:Beginners@haskell.org"
              moz-do-not-send="true">Beginners@haskell.org</a><br>
            <a
              href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/beginners</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>