मैं अभ्यास हास्केल ट्रैक से "रोमन-अंकों" कार्य पर काम कर रहा हूं और उनके instructions to installing stack का पालन करता हूं। मैं फेडोरा 24 बॉक्स पर काम कर रहा हूं।मैं अपने। कैबल फ़ाइल में "कंटेनर" पैकेज कैसे जोड़ूं (संकलन समय पर ढेर द्वारा ओवरराइट किए बिना)?
जब तक मैं आधार से हास्केल मॉड्यूल के साथ काम कर रहा था, मुझे कोई समस्या नहीं थी। अब मैं Data.Map मॉड्यूल आयात करने की कोशिश कर रहा हूं।
import qualified Data.Map as M (foldlWithKey, fromList)
मैं समस्याओं में चला रहा हूँ जब मैं चलाने का प्रयास: जब मैं कमांड के साथ मेरी स्रोत फ़ाइल के अंदर से यह आयात करने का प्रयास
$ ghci
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> import Data.Map
Prelude Data.Map>
हालांकि,: यह GHCi कमांड लाइन का उपयोग कर ठीक काम करता है परीक्षण:
$ stack test
roman-numerals-0.0.0: build (lib + test)
Preprocessing library roman-numerals-0.0.0...
[2 of 2] Compiling Roman (...)
(...) /roman-numerals/src/Roman.hs:3:1: error:
Failed to load interface for ‘Data.Map’
It is a member of the hidden package ‘containers-0.5.7.1’.
Perhaps you need to add ‘containers’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
Progress: 1/2
(...)
मैं इस समस्या googled और the Cabal FAQ at haskell.org पर एक सीधा समाधान नहीं मिला:
बिल्ड करने के लिए कंटेनर जोड़ने के लिए आपको क्या करना है-आपकी फ़ाइल में निर्भर करता है।
मुझे लगता है कि उनका मतलब है कि फ़ाइल रोमैन-numerals.cabal है जो मेरी कामकाजी निर्देशिका में है। सामग्री हैं:
-- This file has been generated from package.yaml by hpack version 0.14.0.
--
-- see: https://github.com/sol/hpack
name: roman-numerals
version: 0.0.0
build-type: Simple
cabal-version: >= 1.10
library
hs-source-dirs:
src
build-depends:
base
exposed-modules:
Roman
other-modules:
Paths_roman_numerals
default-language: Haskell2010
test-suite test
type: exitcode-stdio-1.0
main-is: Tests.hs
hs-source-dirs:
test
build-depends:
base
, roman-numerals
, hspec
default-language: Haskell2010
मैं करने के लिए "कंटेनरों" जोड़ने की कोशिश की या तो और दोनों "पुस्तकालय" और "टेस्ट सूट" वर्गों में निर्माण निर्भर करता है, लेकिन जब मैं
$ stack test
चलाने त्रुटि बनी रहती है, और .cabal फ़ाइल ऊपर दिखाए गए समान सामग्री पर वापस लाई जाती है।
कोई बात नहीं? बहुत सराहना की!
धन्यवाद! यह काम किया। – ktiu