2015-09-20 19 views
143

sto cercando di utilizzare il plugin ghc-mod vim per farlo tipo/controllo della sintassi, ecc Tuttavia, ho trovato che ghc-mod utilizza sempre percorsi completi di tipi nei messaggi di errore, ad esempio:GHC-mod deve utilizzare nomi completi per i tipi?

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 
... 

che ingombra le schermo ed è molto difficile per me scoprire dove è andato storto. Come confronto, questo è il messaggio di errore per lo stesso file utilizzando 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 
... 

che è molto più pulito. C'è un modo per rendere ghc-mod i nomi brevi per i tipi?

+3

Questo non è il comportamento osservato per me. Questo sta ancora accadendo per te? Quali versioni di 'ghc' e' ghc-mod' stai usando? – dkasak

+3

Hai un esempio autonomo (importazioni incluse) che genera output come sopra? Penso di avere un'idea di quale potrebbe essere il problema, ma è un po 'difficile da dire solo sull'output ... – Alec

risposta

0

È possibile provare a passare -dsuppress-module-prefixes come opzione GHC. Ad un certo punto, mi ha aiutato a sbarazzarmi dei qualificatori di moduli nei nomi.

1

è possibile passare l'argomento per GHC dalla GHC-mod come:

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

Questo invierà l'argomento -dsuppress-module-prefixes a GHC.