To be clear, I think DefaultSignatures should still be an option, but possibly guarded by some CPP.<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Dec 12, 2012 at 6:31 AM, <a href="mailto:dag.odenhall@gmail.com">dag.odenhall@gmail.com</a> <span dir="ltr">&lt;<a href="mailto:dag.odenhall@gmail.com" target="_blank">dag.odenhall@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The practice seems to be to not export it, but maybe it would be a better practice to export it. That way it can work without DefaultSignatures too, and if you use the generic-deriving package it could work with zero extensions or GHC-specific dependencies.<br>


<br>Are you adding support to hashable after all? I&#39;d love that, but thought you decided against it because of the clash with the existing defaults.<div class="HOEnZb"><div class="h5"><br><div class="gmail_extra"><br>

<br><div class="gmail_quote">On Wed, Dec 12, 2012 at 5:28 AM, Johan Tibell <span dir="ltr">&lt;<a href="mailto:johan.tibell@gmail.com" target="_blank">johan.tibell@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I noticed that you&#39;re not required to export the types mentioned in<br>
the default method signature. For example, you could have:<br>
<br>
    default hashWithSalt :: (Generic a, GHashable (Rep a)) =&gt; Int -&gt; a -&gt; Int<br>
    hashWithSalt salt = ghashWithSalt salt . from<br>
<br>
and not export the GHashable class. However, if users try to define an<br>
instance of Hashable but forget to derive Generic:<br>
<br>
    data Foo a = Foo a String<br>
                 deriving (Eq)  -- Oops, forgot Generic here<br>
<br>
    instance (Hashable a) =&gt; Hashable (Foo a)<br>
<br>
they get a pretty bad error message:<br>
<br>
Test.hs:10:10:<br>
    Could not deduce (Generic (Foo a),<br>
                      Data.Hashable.Class.GHashable (GHC.Generics.Rep (Foo a)))<br>
      arising from a use of `Data.Hashable.Class.$gdmhashWithSalt&#39;<br>
    from the context (Hashable a)<br>
      bound by the instance declaration at Test.hs:10:10-41<br>
    Possible fix:<br>
      add (Generic (Foo a),<br>
           Data.Hashable.Class.GHashable<br>
             (GHC.Generics.Rep (Foo a))) to the context of<br>
        the instance declaration<br>
      or add instance declarations for<br>
         (Generic (Foo a),<br>
          Data.Hashable.Class.GHashable (GHC.Generics.Rep (Foo a)))<br>
    In the expression: (Data.Hashable.Class.$gdmhashWithSalt)<br>
    In an equation for `hashWithSalt&#39;:<br>
        hashWithSalt = (Data.Hashable.Class.$gdmhashWithSalt)<br>
    In the instance declaration for `Hashable (Foo a)&#39;<br>
<br>
Exporting GHashable would help a little bit in that users would at<br>
least know what this GHashable class that the error talks about is.<br>
<br>
What&#39;s best practice?<br>
<br>
-- Johan<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>