<div dir="auto">Any ANN annotation triggers the TH pipeline and makes them really painful to work with, in non-stage2 settings. Lots of Hlint annotations use ANN and then you have iserv be triggered for each module that has an ANN annotation.</div><div dir="auto"><br></div><div dir="auto">Luckily Hlint also support HLINT instead which removed the TH pipeline.</div><div dir="auto"><br></div><div dir="auto">That alone is enough for me personally to recommend against using ANN if there is an alternator option to anyone who asks me.</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 4 Dec 2023 at 5:01 PM, Simon Peyton Jones <<a href="mailto:simon.peytonjones@gmail.com">simon.peytonjones@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">The whole <a href="https://ghc.gitlab.haskell.org/ghc/doc/users_guide/extending_ghc.html?highlight=ann#source-annotations" target="_blank" style="font-family:tahoma,sans-serif">ANN mechanism </a>is, at root, a good idea. It is pretty generan, and allows annotations to be arbitrary expressions, provided they are in Typable and Data. And they are serialised across modules.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">In practice though, I'm not sure how widely used they are. I'm not sure why. I'd love to hear of counter-examples.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Only top level binders can be annotated; but there is no reason in principle that you should not annotate instance declarations. I don't think it'd be too hard to implement.</div></div><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 2 Dec 2023 at 14:51, Jaro Reinders <<a href="mailto:jaro.reinders@gmail.com" target="_blank">jaro.reinders@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Hi GHC devs,<br>
<br>
I'm working on a GHC plugin which implements a custom instance resolution <br>
mechanism:<br>
<br>
<a href="https://github.com/noughtmare/transitive-constraint-plugin" rel="noreferrer" target="_blank">https://github.com/noughtmare/transitive-constraint-plugin</a><br>
<br>
Currently, I need to place instances in a specific order in a specific file to <br>
recognize them and use them in my plugin. I think my life would be a lot easier <br>
if I could put annotations on instances. I imagine a syntax like this:<br>
<br>
data MyInstanceTypes = Refl | Trans deriving Eq<br>
<br>
class f <= g where<br>
inj :: f x -> g x<br>
<br>
instance {-# ANN instance Refl #-} f <= f where<br>
inj = id<br>
<br>
instance {-# ANN instance Trans #-}<br>
forall f g h. (f <= g, g <= h) => f <= h<br>
where<br>
inj = inj @g @h . inj @f @g<br>
<br>
Using this information I should be able to find the right instances in a more <br>
reliable way.<br>
<br>
One more thing I was thinking about is to make it possible to remove these <br>
instances from the normal resolution algorithm and only allow them to be used <br>
by my plugin.<br>
<br>
Do you think this would be easy to implement and useful? Or are there other <br>
ways to achieve this?<br>
<br>
Cheers,<br>
<br>
Jaro<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://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></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://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div></div>