私は、演技ハスケルトラックの "roman-numbers"タスクに取り組み、彼らのinstructions to installing stackに従っています。私はFedora 24の箱に取り組んでいます。コンパイル時にスタックによって上書きされることなく、.cabalファイルに "containers"パッケージを追加するにはどうすればよいですか?
ベースからHaskellモジュールを使用している限り、問題はありませんでした。今私は、Data.Mapモジュールをインポートしようとしています。私が実行しようとすると、
import qualified Data.Map as M (foldlWithKey, fromList)
私が問題に実行している:私はコマンドを使用して、私のsrcファイルの内部からそれをインポートしようとすると、しかし
$ 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
(...)
は私が問題をGoogleで検索してthe Cabal FAQ at haskell.orgで簡単な解決策を見つけた:
あなたがする必要があるのは、.cabalファイルのbuild-dependsにコンテナを追加することです。
私は自分の作業ディレクトリにあるファイルroman-figures.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