<div dir="ltr"><div>Simon - GHC provides some protection against mistyped pragma names, in the form of the -Wunrecognised-pragmas warning, but only for {-# ... #-} pragmas. If tools decide to use their own pragma syntax, they don't benefit from this. That's one downside, in addition to the others that Neil mentioned.</div><div><br></div><div>You might say we shouldn't care about mistyped pragma names. If the user accidentally writes {- HLNIT -} and it is silently ignored, that's not our problem. OK, but we cared about it enough for the pragmas that GHC understands to add the special warning, and it's reasonable to expect that HLint users also care about it. <br></div><div><br></div><div>(personally I have no stance on whether we should have this warning, there are upsides and downsides. But that's where we are now.)</div><div><br></div><div>Cheers</div><div>Simon<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, 16 Oct 2018 at 23:34, Simon Peyton Jones <<a href="mailto:simonpj@microsoft.com">simonpj@microsoft.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-GB" link="blue" vlink="purple">
<div class="m_6101010111855737458WordSection1">
<p class="MsoNormal"><span>I’m still not understanding what’s wrong with<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>{- HLINT blah blah -}<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>GHC will ignore it.  HLint can look at it.  Simple.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>I must be missing something obvious.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Simon<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> ghc-devs <<a href="mailto:ghc-devs-bounces@haskell.org" target="_blank">ghc-devs-bounces@haskell.org</a>>
<b>On Behalf Of </b>Simon Marlow<br>
<b>Sent:</b> 16 October 2018 21:44<br>
<b>To:</b> Neil Mitchell <<a href="mailto:ndmitchell@gmail.com" target="_blank">ndmitchell@gmail.com</a>><br>
<b>Cc:</b> ghc-devs <<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a>><br>
<b>Subject:</b> Re: Treatment of unknown pragmas<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">I suggested to Neil that he add the {-# HLINT #-} pragma to GHC. It seemed like the least worst option taking into account the various issues that have already been described in this thread. I'm OK with adding HLINT; after all we already
 ignore OPTIONS_HADDOCK, OPTIONS_NHC98, a bunch of other OPTIONS, CFILES (a Hugs relic), and several more that GHC ignores.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">We can either<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(a) not protect people from mistyped pragmas, or <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">(b) protect people from mistyped pragma names, but then we have to bake in the set of known pragmas<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">We could choose to have a different convention for pragmas that GHC doesn't know about (as Ben suggests), but then of course we don't get any protection for mistyped pragma names when using that convention.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Cheers<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Simon<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, 16 Oct 2018 at 21:12, Neil Mitchell <<a href="mailto:ndmitchell@gmail.com" target="_blank">ndmitchell@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">> A warning flag is an interesting way to deal with the issue. On the<br>
> other hand, it's not great from an ergonomic perspective; afterall, this<br>
> would mean that all users of HLint (and any other tool requiring special<br>
<br>
Yep, this means every HLint user has to do an extra thing. I (the<br>
HLint author) now have a whole pile of "how do I disable warnings in<br>
Stack", and "what's the equivalent of this in Nix". Personally, it ups<br>
the support level significantly that I wouldn't go this route.<br>
<br>
I think it might be a useful feature in general, as new tools could<br>
use the flag to prototype new types of warning, but I imagine once a<br>
feature gets popular it becomes too much fuss.<br>
<br>
> > I think it makes a lot of sense to have a standard way for third-parties<br>
> > to attach string-y information to Haskell source constructs. While it's<br>
> > not strictly speaking necessary to standardize the syntax, doing<br>
> > so minimizes the chance that tools overlap and hopefully reduces<br>
> > the language ecosystem learning curve.<br>
><br>
> This sounds exactly like the existing ANN pragma, which is what I've wanted LiquidHaskell to move towards for a long time. What is wrong with using the ANN pragma?<br>
<br>
Significant compilation performance penalty and extra recompilation.<br>
ANN pragmas is what HLint currently uses.<br>
<br>
>  I'm a bit skeptical of this idea. Afterall, adding cases to the<br>
> lexer for every tool that wants a pragma seems quite unsustainable.<br>
<br>
I don't find this argument that convincing. Given the list already<br>
includes CATCH and DERIVE, the bar can't have been _that_ high to<br>
entry. And yet, the list remains pretty short. My guess is the demand<br>
is pretty low - we're just whitelisting a handful of additional words<br>
that aren't misspellings.<br>
<br>
Thanks, Neil<br>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-devs&data=02%7C01%7Csimonpj%40microsoft.com%7Cdb8a204f9dad40d006c208d633a82851%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636753194654711612&sdata=YkmmZJVadGOaWzWtSRQf18D058PdEhj8IiGwF%2B%2BGZFs%3D&reserved=0" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>

</blockquote></div>