क्या जीएचसी-मॉड को पूर्ण नामों का उपयोग करना है?


143

मैं ghc-modटाइप / सिंटैक्स जाँच आदि करने के लिए vim प्लगइन का उपयोग करने की कोशिश कर रहा हूँ । हालाँकि, मैंने पाया कि ghc-modहमेशा त्रुटि संदेशों में पूर्ण पथों का उपयोग करता है, उदाहरण के लिए:

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प्रकारों के लिए छोटे नामों का उपयोग करने का एक तरीका है ?


3
यह मेरे लिए मनाया व्यवहार नहीं है। क्या यह अभी भी आपके लिए हो रहा है? जिसके संस्करण ghcऔर ghc-modआप उपयोग कर रहे हैं?
— dkasak

3
क्या आपके पास एक स्व-निहित उदाहरण (आयात शामिल है) जो उपरोक्त की तरह आउटपुट उत्पन्न करता है? मुझे लगता है कि मेरे पास एक विचार है कि समस्या क्या हो सकती है, लेकिन केवल आउटपुट से यह बताना थोड़ा कठिन है ...
— एलेक

जवाबों:


1

आप ghc-mod से ghc के तर्क को पास कर सकते हैं:

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

यह तर्क -dsuppress-module-prefixesको ghc पर भेजेगा।


0

आप -dsuppress-module-prefixesएक GHC विकल्प के रूप में पासिंग की कोशिश कर सकते हैं । कुछ बिंदु पर, इसने मुझे नामों में मॉड्यूल क्वालिफायर से छुटकारा पाने में मदद की।

हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.