Does GHC-mod have to use full names for types? Ask Question

Does GHC-mod have to use full names for types? Ask Question

I'm trying to use the ghc-mod vim plugin to do type/syntax checking etc. However, I found that ghc-mod always uses full paths of types in the error messages, for example:

test.hs|71 col 13 error| Couldn't match type ‘Data.Text.Internal.Text’                                                                                   
||                with ‘[GHC.Types.Char]’
|| Expected type: containers-0.5.6.2:Data.Map.Base.Map
||                  [GHC.Types.Char]
||                  ([(integer-gmp-1.0.0.0:GHC.Integer.Type.Integer,
||                     integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)],
||                   containers-0.5.6.2:Data.Set.Base.Set
||                     integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)
||   Actual type: containers-0.5.6.2:Data.Map.Base.Map
||                  Data.Text.Internal.Text
||                  ([(integer-gmp-1.0.0.0:GHC.Integer.Type.Integer,
||                     integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)],
||                   containers-0.5.6.2:Data.Set.Base.Set
||                     integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)
|| In the second argument of ‘containers-0.5.6.2:Data.Map.Base.map’, namely
||   ‘zippedMap’
|| In the second argument of ‘(GHC.Base.$)’, namely
||   ‘containers-0.5.6.2:Data.Map.Base.map
...

画面が乱雑になり、どこが間違っているのかを見つけるのが非常に困難になります。比較として、同じファイルを使用した場合のエラー メッセージは次のとおりですghci

test.hs:71:13:
    Couldn't match type ‘T.Text’ with ‘[Char]’
    Expected type: M.Map [Char] ([(Integer, Integer)], S.Set Integer)
      Actual type: M.Map T.Text ([(Integer, Integer)], S.Set Integer)
    In the second argument of ‘M.map’, namely ‘zippedMap’
    In the second argument of ‘($)’, namely
      ‘M.map
...

ghc-modはるかにきれいになりました。型に短い名前を使用する方法はありますか?

ベストアンサー1

ghc-mod から ghc に引数を渡すには、次のようにします。

$ ghc-mod lint *.hs -g -dsuppress-module-prefixes

これにより、引数が-dsuppress-module-prefixesghc に送信されます。

おすすめ記事