如何在小块中禁用Haskell警告? [英] How can I disable Haskell warning in small block?

查看:57
本文介绍了如何在小块中禁用Haskell警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想禁用某些代码块的警告。

I want to disable warning only some block of code.

我搜索了Google,但只找到了文件范围或全局范围禁用方法。
使用阴谋文件或杂注

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?

推荐答案

不,您当前无法使用GHC 8.10.1

No, you can't currently in GHC 8.10.1

{-#OPTIONS_GHC#-} pragma仅是文件头,并且适用于整个模块。而且,没有这样的实用程序(或其他方式)可以抑制特定位置的警告。您可以在Haskell用户指南中查看编译指示的完整列表:

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

这篇关于如何在小块中禁用Haskell警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆