2016-09-07 6 views
8

में मैं हास्केल के लिए नया हूँ और एक मुद्दा निम्नलिखित कोड चलाने हो रहा है:'हैलो, वर्ल्ड!' चलाना और संकलित करना हास्केल

module Main (
main 
) where 
main = putStrLn "Hello, world!" 

SublimeHaskell संकलन और

runhaskell hello.hs 

जो त्रुटि देता है का उपयोग करके उपरोक्त चलाने की कोशिश करता है

hello.o: getModificationTime: invalid argument (The system cannot find the file specified.) 

मैंने

का उपयोग करके इसे चलाने का भी प्रयास किया है
ghc --make hello.hs 

एक ही त्रुटि के साथ।

CreateDirectory ".": invalid argument (Cannot create a file when that file already exists.) 

दूसरी ओर, मैं इस मुद्दे के बिना आरईपीएल के माध्यम से कार्यक्रम चला सकते हैं: जब मैं पहले कमांड लाइन

ghc -c hello.hs 

का उपयोग कर चल मैन्युअल रूप से कोड को संकलित करने की कोशिश मुझे कोई दूसरी त्रुटि मिलती है:

ghci 
GHCi, version 8.0.1: http://www.haskel.org/ghc/ :? for help 
Prelude> putStrLn "Hello, world!" 
Hello, world! 

यदि यह प्रासंगिक है, मैं विंडोज 7 का उपयोग कर रहा है, और मैं हास्केल मंच इंस्टॉलर का उपयोग GHC स्थापित।

*** संपादित -v ध्वज के साथ ऊपर बताए गए आदेशों चल निम्नलिखित परिणाम देता है:

ghc -v hello.hs 

Glasgow Haskell Compiler, Version 8.0.1, stage 2 booted by GHC version  7.10.2 
Using binary package database: C:\Program Files\Haskell  Platform\8.0.1\lib\package.conf.d\package.cache 
loading package database C:\Program Files\Haskell Platform\8.0.1\lib\package.conf.d 
wired-in package ghc-prim mapped to ghc-prim-0.5.0.0 
wired-in package integer-gmp mapped to integer-gmp-1.0.0.1 
wired-in package base mapped to base-4.9.0.0 
wired-in package rts mapped to rts 
wired-in package template-haskell mapped to template-haskell-2.11.0.0 
wired-in package ghc mapped to ghc-8.0.1 
wired-in package dph-seq not found. 
wired-in package dph-par not found. 
Hsc static flags: 
loading package database C:\Program Files\Haskell  Platform\8.0.1\lib\package.conf.d 
wired-in package ghc-prim mapped to ghc-prim-0.5.0.0 
wired-in package integer-gmp mapped to integer-gmp-1.0.0.1 
wired-in package base mapped to base-4.9.0.0 
wired-in package rts mapped to rts-1.0 
wired-in package template-haskell mapped to template-haskell-2.11.0.0 
wired-in package ghc mapped to ghc-8.0.1 
wired-in package dph-seq not found. 
wired-in package dph-par not found. 
*** Chasing dependencies: 
Chasing modules from: *hello.hs 
*** Deleting temp files: 
Deleting: 
*** Deleting temp dirs: 
Deleting: 
hello.o: getModificationTime: invalid argument (The system cannot find the file specified.) 

ghc -c -v hello.hs 

Glasgow Haskell Compiler, Version 8.0.1, stage 2 booted by GHC version 7.10.2 
Using binary package database: C:\Program Files\Haskell  Platform\8.0.1\lib\package.conf.d\package.cache 
loading package database C:\Program Files\Haskell Platform\8.0.1\lib\package.conf.d 
wired-in package ghc-prim mapped to ghc-prim-0.5.0.0 
wired-in package integer-gmp mapped to integer-gmp-1.0.0.1 
wired-in package base mapped to base-4.9.0.0 
wired-in package rts mapped to rts 
wired-in package template-haskell mapped to template-haskell-2.11.0.0 
wired-in package ghc mapped to ghc-8.0.1 
wired-in package dph-seq not found. 
wired-in package dph-par not found. 
Hsc static flags: 
*** Checking old interface for Main: 
*** Parser [Main]: 
!!! Parser [Main]: finished in 0.00 milliseconds, allocated 0.067 megabytes 
*** Renamer/typechecker [Main]: 
!!! Renamer/typechecker [Main]: finished in 46.80 milliseconds, allocated 15.720 megabytes 
*** Desugar [Main]: 
Result size of Desugar (after optimization) 
= {terms: 13, types: 6, coercions: 0} 
!!! Desugar [Main]: finished in 0.00 milliseconds, allocated 0.204 megabytes 
*** Simplifier [Main]: 
Result size of Simplifier iteration=1 
= {terms: 17, types: 8, coercions: 0} 
Result size of Simplifier = {terms: 17, types: 8, coercions: 0} 
!!! Simplifier [Main]: finished in 0.00 milliseconds, allocated 0.171 megabytes 
*** CoreTidy [Main]: 
Result size of Tidy Core = {terms: 17, types: 8, coercions: 0} 
!!! CoreTidy [Main]: finished in 0.00 milliseconds, allocated 2.558 megabytes 
*** Deleting temp files: 
Deleting: 
*** Deleting temp dirs: 
Deleting: 
CreateDirectory ".": invalid argument (Cannot create a file when that file already exists.) 

चारों ओर देखने के बाद, ऐसा लगता है कि दो संकुल कि रूप में सूचीबद्ध हैं नहीं मिला (dph-seq और dph-par) है बहिष्कृत किया गया

+5

नाम बदलने चाहिए खैर, हाँ, यह निश्चित रूप से प्रासंगिक है कि आप विंडोज 7 का उपयोग कर रहे है और इसलिए हास्केल पारिस्थितिकी तंत्र है - तुम कैसे GHC स्थापित किया था? ढेर के साथ, या किसी अन्य तरीके से? ... मुझे पता है कि मुझे नहीं करना चाहिए, लेकिन मैं निश्चित रूप से इस तरह की परेशानी से छुटकारा पाने के लिए कुछ लिनक्स डिस्ट्रो पर स्विच करने की सिफारिश करने में मदद नहीं कर सकता। (लेकिन मैंने सुना है कि स्टैक के साथ जीएचसी आजकल विंडोज़ पर भी आसान होना चाहिए, इसलिए ...) – leftaroundabout

+1

क्या आपका ड्राइव भरा हुआ है? –

+0

दुर्भाग्यवश, मैं विंडोज़ के साथ फंस गया हूं जब मैंने हास्केल प्लेटफार्म इंस्टॉलर का उपयोग करके जीएचसी स्थापित किया था। ड्राइव पूर्ण ~ 8 जीबी स्पेस नहीं है। – Fortunato

उत्तर

0

जीएचसी की आवश्यकता है कि फ़ाइल को संकलित करने के लिए मॉड्यूल के समान ही नाम दिया जाए। हालांकि, किसी भी मॉड्यूल को फ़ाइल नाम के बावजूद जीएचसीआई में लोड किया जा सकता है। यही कारण है कि प्रतिकृति काम किया लेकिन संकलन नहीं किया था।

आपके मामले में, इसलिए, आप फ़ाइल Main.hs

संबंधित मुद्दे