Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Haskell未能加载模块的接口_Haskell_Visual Studio Code_Cabal - Fatal编程技术网

Haskell未能加载模块的接口

Haskell未能加载模块的接口,haskell,visual-studio-code,cabal,Haskell,Visual Studio Code,Cabal,你好,我正在尝试在另一个模块中使用一个模块,但它似乎不起作用。我尝试更新了cabal文件、堆栈,重新安装了平台、ghc和所有东西,但它不允许导入模块。我尝试在cabal文件中添加其他模块和主模块部分。没有效果。可能是什么问题 模块: module Test where test::IO() test=do elem<-getLine print elem module Main where import Test main ::

你好,我正在尝试在另一个模块中使用一个模块,但它似乎不起作用。我尝试更新了cabal文件、堆栈,重新安装了平台、ghc和所有东西,但它不允许导入模块。我尝试在cabal文件中添加其他模块和主模块部分。没有效果。可能是什么问题

模块:

module Test where


    test::IO()
    test=do
        elem<-getLine
        print elem


module Main where

import Test

main :: IO ()
main = do
  putStrLn "hello world"
模块测试,其中
测试::IO()
测试=do

elem其他模块:
指令必须进入
可执行控制台
节。

N.B.我也尝试过此解决方案,但仍然存在相同的问题。@BercoviciAdrian无法重现。向我们展示
console.cabal
的版本,您认为该版本包含了我提出的修复方案,但仍会产生这些消息。@Bercoviciarian您更改了两件事:删除了
构建依赖项:
行(为什么??),并移动了
其他模块:
行。不要那样做。将
构建依赖于:
行保持原样,只将
其他模块
移动到
可执行控制台
小节。@Bercoviciarian这听起来像是一个完全不同的问题。请随时打开一个新的职位与进一步的细节!
Resolving dependencies...
Configuring console-0.1.0.0...
Warning: To use the 'default-language' field the package needs to specify at
least 'cabal-version: >= 1.10'.
Preprocessing executable 'console' for console-0.1.0.0..
Building executable 'console' for console-0.1.0.0..

<no location info>: warning: [-Wmissing-home-modules]
    These modules are needed for compilation but not listed in your .cabal file's other-modules: Test

<no location info>: warning: [-Wmissing-home-modules]
    These modules are needed for compilation but not listed in your .cabal file's other-modules: Test
C:\<path>\Main.hs:4:1: error:
    Failed to load interface for `Test'
    Use -v to see a list of the files searched for.
Failed, modules loaded: none.
H>>= :module + *Main
 name:                console
version:             0.1.0.0
-- synopsis:
-- description:
homepage:            https://github.com/githubuser/console#readme
license:             BSD3
license-file:        LICENSE
author:              Bercovici Adrian Simon
maintainer:          example@example.com
copyright:           2018 Bercovici Adrian Simon
category:            Web
build-type:          Simple
cabal-version:       >=1.2
extra-source-files:  README.md


Executable console
  hs-source-dirs:      src
  main-is:             Main.hs
  default-language:    Haskell2010

  build-depends:       base                  >= 4.7    && < 5
  other-modules:       Test