Warning suppression pragmas

Ben Gamari ben at well-typed.com
Tue Oct 27 23:24:22 UTC 2015

Эдгар Жаворонков <edzhavoronkov at gmail.com> writes:

> Hi Ben!
> I concreted some points in local warnings suppression pragmas wiki page
> with specification.


Things are definitely improving! I still think you should be more
explicit about the possible uses here. In particular, what pain-points
felt by users today does this proposal address?

If I were you, I would try to collect some small examples of typical
code snippets where you might want to put your pragma to use. The recent
monad-of-no-return discussion might be a good place to start looking;
you likely have some in your own code as well. Place these in the
proposal and describe how your pragma would be employed to satisfy these

A few other points,

 * "... that can perform some unsafe actions(unsafe I/O maybe)":

   Unsafe I/O currently doesn't trigger any warnings that I can think of
   so this this might not be the best example to use here.

 * "... you don't want to read such long warning's texts":

   This also probably isn't the sort of use-case we'd want to design
   for. The typical use-case here is that you want to tell the
   compiler that you know something that it doesn't see.

 * "{-# SUPPRESS #-}":

   I'm not yet convinced that we want to allow such a blanket pragma.
   A specific example showing the benefit of such a large hammer would

 * "{-# SUPPRESS foo  #-}"

   What is "foo" here? Be specific! What are the valid tokens you'd want
   to see here?

You might consider having a look at some of the other proposals (e.g.
the Custom Type Errors proposal [1]) for some inspiration on how to
structure the document.

> https://ghc.haskell.org/trac/ghc/wiki/Design/LocalWarningPragmas
> Do you know something about defining custom pragmas in GHC?
> I suppose, i need to add it to the lexer and parser.
Yes, this would be necessary.

> In that case, how can i understand, that GHC recognizes my pragma?

> I want to try a few things on my local machine
Fair enough. Nevertheless, I would encourage you to take think carefully
about the proposal before diving too deeply into the code. A bit of
forethought can save substantial effort later on!

Thanks again for your efforts!


- Ben

[1] https://ghc.haskell.org/trac/ghc/wiki/Proposal/CustomTypeErrors
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20151028/65dcd2e2/attachment.sig>

More information about the ghc-devs mailing list