haskell无法导入Data.List模块

时间:2020-06-25 16:57:08

标签: haskell haskell-stack

  |
4 |   import Data.List.Split
  |   ^^^^^^^^^^^^^^^^^^^^^^


--  While building package myproj-0.1.0.0 using:

    Process exited with code: ExitFailure 1

我收到此错误,如何将模块导入haskell文件? 在vs代码中进行编译或调试时出现此错误

使用堆栈构建进行编译后,文件中出现第二个错误,我已经在Cabal构建依赖项中添加了Split

Cabal file 

Building all executables for `myproj' once. After a successful build of all of them, only specified executables will be rebuilt.
myproj> configure (exe)
Warning: myproj.cabal:21:10: Tabs used as indentation at 21:10
Configuring myproj-0.1.0.0...
myproj> build (exe)
Preprocessing executable 'myproj' for myproj-0.1.0.0..
Building executable 'myproj' for myproj-0.1.0.0..

<no location info>: error:
    output was redirected with -o, but no output will be generated
because there is no Main module.

1 个答案:

答案 0 :(得分:0)

首先,您需要找出模块包含在哪个软件包中。

https://hoogle.haskell.org/?hoogle=Data.List.Split

因此,您需要split package。放入build-depends文件的myproj.cabal(如果使用package.yamlhpack,则放入stack

   split >=0.2 && <0.3

(版本边界是可选的,但建议在有疑问时修复x.y)

然后,在下一次构建时,cabalstack将引入所需的依赖关系,从而使该模块可用。