{-# ANN module ("HLint: ignore Use infix"::String) #-}
{-# ANN module ("HLint: ignore Use mappend"::String) #-}
{-# ANN module ("HLint: ignore Use fmap"::String) #-}
{-# ANN module ("HLint: error Redundant $"::String) #-}
{-# ANN module ("HLint: ignore Use ."::String) #-}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试将我的包标记为安全时
{-# LANGUAGE Safe #-}
Run Code Online (Sandbox Code Playgroud)
我明白了
• Annotations are not compatible with Safe Haskell.
See https://ghc.haskell.org/trac/ghc/ticket/10826
• In the annotation:
{-# ANN module ("HLint: ignore Use ." :: String) #-}
|
80 | {-# ANN module ("HLint: ignore Use ."::String) #-}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Run Code Online (Sandbox Code Playgroud)
删除注释后,我可以构建并测试为Safe而不会出错.
是否有另一种自定义Hlint的方法,可以将我的包标记为安全?
ANN您可以使用以下任一方法来代替使用编译指示:
{-# HLINT ignore "Use mappend" #-}
Run Code Online (Sandbox Code Playgroud)
或者:
{- HLINT ignore "Use mappend" -}
Run Code Online (Sandbox Code Playgroud)
前者将触发 GHC 关于未知编译指示的警告。
也可以看看:
https://github.com/ndmitchell/hlint#ignoring-hints