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
...
which clutters the screen and it's very hard for me to find out where went wrong. As comparison, this is the error message for the same file using 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
...
which is much cleaner. Is there a way to make ghc-mod
use short names for the types?
You can pass the argument to ghc from ghc-mod as:
$ ghc-mod lint *.hs -g -dsuppress-module-prefixes
This will send the argument -dsuppress-module-prefixes
to ghc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With