<div dir="ltr">But what stops the user from defining their own instances if they in fact did not derive it?<div><br></div><div>The explicit "False" in Pedro's formulation seems to serve this purpose.<br><div>

<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 14, 2013 at 11:20 PM, Nicolas Frisby <span dir="ltr"><<a href="mailto:nicolas.frisby@gmail.com" target="_blank">nicolas.frisby@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The formulation as a type family seems to conflict with the open-world principle. Would a class-based encoding instead be sufficient?<div>

<br></div><div><span style="font-family:'courier new',monospace">-- the proposed, special wired-in class</span><br>


</div><div><font face="courier new, monospace">class Derives (t :: k1) (c :: k2)</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">-- GHC would infer these from Pedro's example's declarations</font></div>




<div><font face="courier new, monospace">instance Derives MyData Eq</font></div><div><font face="courier new, monospace">instance Derives MyData Generic<br></font></div><div><font face="courier new, monospace">instance Derives MyData Show</font><br>




</div><div><br></div><div>NB that there is no instance <font face="courier new, monospace">Derives MyData Ord</font>, but standalone deriving could yield one "later"<br></div><div><div class="h5"><div class="gmail_extra">

<br>
<div class="gmail_quote">On Mon, Oct 14, 2013 at 10:02 PM, Ryan Newton <span dir="ltr"><<a href="mailto:rrnewton@gmail.com" target="_blank">rrnewton@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div dir="ltr">Hey, that's an awesome formulation!  Thanks Pedro.<div class="gmail_extra"><br></div><div class="gmail_extra">Any idea how much work this would be to implement in GHC, if it did garner approval?</div><div class="gmail_extra">






<br><br><div class="gmail_quote"><div><div>On Tue, Oct 8, 2013 at 3:48 AM, José Pedro Magalhães <span dir="ltr"><<a href="mailto:dreixel@gmail.com" target="_blank">dreixel@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>

<div dir="ltr">Hi,<br><div><div class="gmail_extra"><br><div class="gmail_quote"><div>On Mon, Oct 7, 2013 at 10:32 AM, Dag Odenhall <span dir="ltr"><<a href="mailto:dag.odenhall@gmail.com" target="_blank">dag.odenhall@gmail.com</a>></span> wrote:<br>








<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><p style="margin:1.2em 0px!important">Here‘s a thought: doesn’t <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px 3px 3px 3px;display:inline">Generic</code> already have an unused phantom type that's only there “just in case we need to add something in the future”?</p>








</div></div></blockquote></div><div>No, it doesn't.<br><br></div><div>Just a thought: what if we had a type family<br><br></div><div><span style="font-family:courier new,monospace">type family Derives (t :: k1) (c :: k2) :: Bool</span><br>








<br></div><div>which would automatically be instantiated by GHC appropriately? E.g., if the user had the following code:<br><br></div><div><span style="font-family:courier new,monospace">data MyData = MyData deriving (Eq, Generic)<br>








</span></div><div><span style="font-family:courier new,monospace">deriving instance Show MyData<br></span></div><div><span style="font-family:courier new,monospace">instance Ord MyData</span><br><br></div><div>GHC would automatically instantiate:<br>








<br></div><div><span style="font-family:courier new,monospace">type instance Derives MyData Eq      = True<br>type instance Derives MyData Generic = True<br>type instance Derives MyData Show    = True<br>type instance Derives MyData Ord     = False</span><br>








<br></div></div>Would this be something Ryan could use for detecting safe instances for LVish?<br><br><br></div><div class="gmail_extra">Cheers,<br>Pedro<br></div></div></div>
<br></div></div><div>_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/mailman/listinfo/ghc-devs</a><br>
<br></div></blockquote></div><br></div></div>
<br>_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/ghc-devs" target="_blank">http://www.haskell.org/mailman/listinfo/ghc-devs</a><br>
<br></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>