我尝试了“stack install megaparsec”,在 project.yaml 文件中添加 megaparsec 和 parsec 作为依赖项并运行 stack build,我尝试在项目文件夹的所有级别上进行 stack build。另外奇怪的是,我可以加载包含被 VSCode 标记为问题的导入的模块并显示错误消息,我还可以运行所述模块中的函数,这些函数使我们可以使用导入的东西,但我无法编译文件。
ghci 版本是 9.0.1
堆栈版本是 2.7.3
阴谋集团版本:1.12
module Parsing where
import Control.Monad (void)
import Data.Void
import Syntax
import Data.Text (Text)
vvvvv these 3 are marked as problems and are the reason I can't compile the file.
import Text.Megaparsec
import Text.Megaparsec.Char
import qualified Text.Megaparsec.Char.Lexer as L
.cabal 文件
library
exposed-modules:
Example
Lib
Parsing
Print
Semantics
Syntax
other-modules:
Paths_parser
hs-source-dirs:
src
build-depends:
base >=4.7 && <5
, containers
, megaparsec
, parsec
, text
default-language: Haskell2010
executable parser-exe
main-is: Main.hs
other-modules:
Paths_parser
hs-source-dirs:
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, parser
default-language: Haskell2010
test-suite parser-test
type: exitcode-stdio-1.0
main-is: Spec.hs
other-modules:
Paths_parser
hs-source-dirs:
test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
, parser
default-language: Haskell2010