[Haskell-beginners] Output of `ghc-mod check` and `runhaskell`

Dontdie YCH dontdieych at gmail.com
Sun Dec 14 08:26:56 UTC 2014


Hello,

My current setup for haskell.

Arch Linux
nix package manager - only for haskell stuff
nix-shell
vim
syntastic + ghc-mod
guard - `cabal run` on change of '*.hs'

I would like to improve readability of ghc-mod's output. Compare to
output of runhaskell, It's quite hard to understand.

~~~
% ghc-mod check LogAnalysis.hs
LogAnalysis.hs:90:25:Couldn't match expected type
‘[ghc-prim:GHC.Types.Char]’            with actual type
‘Log.LogMessage -> [ghc-prim:GHC.Types.Char]’In the second argument of
‘(ghc-prim:GHC.Classes.==)’, namely  ‘upcase GHC.Base..
LogAnalysis.getMsg’In the expression:  str' ghc-prim:GHC.Classes.==
upcase GHC.Base.. LogAnalysis.getMsgIn the expression:  str'
ghc-prim:GHC.Classes.== upcase GHC.Base.. LogAnalysis.getMsg
GHC.Base.$ x
LogAnalysis.hs:90:17:Couldn't match expected type ‘s -> t’
with actual type ‘ghc-prim:GHC.Types.Bool’Relevant bindings include  x
:: s (bound at LogAnalysis.hs:90:13)  p :: s -> t (bound at
LogAnalysis.hs:90:11)The first argument of ($) takes one argument,but
its type ‘ghc-prim:GHC.Types.Bool’ has noneIn the expression:  str'
ghc-prim:GHC.Classes.== upcase GHC.Base.. LogAnalysis.getMsg
GHC.Base.$ xIn an equation for ‘p’:    p x      = str'
ghc-prim:GHC.Classes.== upcase GHC.Base.. LogAnalysis.getMsg
GHC.Base.$ x

% runhaskell LogAnalysis.hs

LogAnalysis.hs:90:17:
    Couldn't match expected type ‘s -> t’ with actual type ‘Bool’
    Relevant bindings include
      x :: s (bound at LogAnalysis.hs:90:13)
      p :: s -> t (bound at LogAnalysis.hs:90:11)
    The first argument of ($) takes one argument,
    but its type ‘Bool’ has none
    In the expression: str' == upcase . getMsg $ x
    In an equation for ‘p’: p x = str' == upcase . getMsg $ x

LogAnalysis.hs:90:25:
    Couldn't match expected type ‘[Char]’
                with actual type ‘LogMessage -> [Char]’
    In the second argument of ‘(==)’, namely ‘upcase . getMsg’
    In the expression: str' == upcase . getMsg
    In the expression: str' == upcase . getMsg $ x
~~~

How I can do either

- change ghc-mod's output like runhaskell or
- use runhaskell for vim syntastic

Thanks.


More information about the Beginners mailing list