2

私は次のことを試しました:

cabal sandbox init

次に、次の cabal ファイルを作成します。

-- Initial hsource.cabal generated by cabal init.  For further 
-- documentation, see http://haskell.org/cabal/users-guide/

name:                hsource
version:             0.1.0.0
-- synopsis:            
-- description:         
-- license:             
license-file:        LICENSE
author:              abc
maintainer:          abc
-- copyright:           
-- category:            
build-type:          Simple
-- extra-source-files:  
cabal-version:       >=1.10

executable hsource
  main-is:             main.hs
  other-modules:       
  -- other-extensions:    
  build-depends:       base >=4.7 && <4.8, csv
  hs-source-dirs:      src
  default-language:    Haskell2010

次に、CSV パッケージを次のようにインストールします。

cabal install --only-dependencies

import Text.CSV試してみるとC-c C-l、次のエラーが表示されます。

Util/RandomTree.hs:7:8-15: Could not find module ‘Text.CSV’ …
    Use -v to see a list of the files searched for.
Compilation failed.

私の質問は、サンドボックスが haskell-mode でサポートされていないのか、それともサンドボックスを機能させるためのいくつかの手順が欠けているのでしょうか?

4

1 に答える 1

1

以下があることを確認してください。

(add-hook 'haskell-mode-hook 'interactive-haskell-mode)

あなたのemacs initファイルに。

haskell-mode でサポートされているさまざまなGHCi プロセス タイプがあります。カバルを使用するものが必要です。

現在適用されているプロセス タイプを確認するには、 を使用M-x describe-variableして入力しhaskell-process-typeます。

Haskell モードのドキュメントは古くなっていると思います。ソースコードを見ると、デフォルトはであり、 .cabal-sandboxディレクトリを見つけることができる場合にauto使用されるためです。それ以外の場合は、 を使用します。cabal-replghci

したがって、またはにhaskell-process-type設定されていて、cabal サンドボックスが見つからない場合は、投稿したエラーが表示されます。現在 に設定されている場合は、次を追加してに変更します。ghciautoghcihaskell-process-typecabal-repl

(custom-set-variables
  '(haskell-process-type 'cabal-repl))

emacs init ファイルに追加し、emacs プロセスを再起動します。

また、コマンド ラインを開き、.cabal ファイルを含むディレクトリに移動してcabal repl. それが機能する場合、カバールのセットアップは問題ありません。

于 2015-02-08T19:13:20.923 に答える