How can I disable Haskell warning in small block?

2019-04-18 03:34发布

I want to disable warning only some block of code.

I searched Google but only find file scope or global scope disable method. Using cabal file or pragma

{-# OPTIONS_GHC #-}

Can I disable warning for specific function?

1条回答
混吃等死
2楼-- · 2019-04-18 04:06

No, you can't currently in GHC 8.6.4.

The {-# OPTIONS_GHC #-} pragma is file-header only and applies to the whole module. And there are no such pragmas (or other ways) to suppress warnings in specific locations. You can check the full list of pragmas in the Haskell user guide:

https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#pragmas

The list of warnings might also be interesting:

https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/using-warnings.html

查看更多
登录 后发表回答