0

我正在尝试编译一个有几年历史并且实际上不再维护的 Haskell 程序。它有一长串依赖项,需要我安装旧版本的uu-parsinglib. 具体来说,它已经计算出它想要uu-parsinglib-2.7.4.3的,但我得到了一个奇怪的编译错误。我是一个相当有经验的程序员,但不是在 Haskell 中,所以我在这里有点摸不着头脑。阴谋集团给了我以下错误:

Failed to install uu-parsinglib-2.7.4.3
Build log ( /Users/pkirlin/projects/hvkoops-ragtime/hvkoops-ragpat-share-6184a5258723/.cabal-sandbox/logs/ghc-7.8.2/uu-parsinglib-2.7.4.3-BnfDYkqunLjFMHWw4iokbw.log ):
cabal: Entering directory '/var/folders/hc/98p9h4tj67b2zvnr2zbmg2_r0000gn/T/cabal-tmp-17434/uu-parsinglib-2.7.4.3'
Configuring uu-parsinglib-2.7.4.3...
Preprocessing library for uu-parsinglib-2.7.4.3..
Building library for uu-parsinglib-2.7.4.3..
[ 1 of 11] Compiling Text.ParserCombinators.UU.README ( src/Text/ParserCombinators/UU/README.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU/README.o )
[ 2 of 11] Compiling Text.ParserCombinators.UU.CHANGELOG ( src/Text/ParserCombinators/UU/CHANGELOG.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU/CHANGELOG.o )
[ 3 of 11] Compiling Text.ParserCombinators.UU.Core ( src/Text/ParserCombinators/UU/Core.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU/Core.o )
[ 4 of 11] Compiling Text.ParserCombinators.UU.Derived ( src/Text/ParserCombinators/UU/Derived.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU/Derived.o )
[ 5 of 11] Compiling Text.ParserCombinators.UU.MergeAndPermute ( src/Text/ParserCombinators/UU/MergeAndPermute.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU/MergeAndPermute.o )
[ 6 of 11] Compiling Text.ParserCombinators.UU.BasicInstances ( src/Text/ParserCombinators/UU/BasicInstances.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU/BasicInstances.o )
[ 7 of 11] Compiling Text.ParserCombinators.UU.Utils ( src/Text/ParserCombinators/UU/Utils.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU/Utils.o )
[ 8 of 11] Compiling Text.ParserCombinators.UU ( src/Text/ParserCombinators/UU.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU.o )
[ 9 of 11] Compiling Text.ParserCombinators.UU.Demo.Examples ( src/Text/ParserCombinators/UU/Demo/Examples.hs, dist/dist-sandbox-e96cf9a6/build/Text/ParserCombinators/UU/Demo/Examples.o )

src/Text/ParserCombinators/UU/Demo/Examples.hs:98:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:99:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:100:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:101:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:102:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:103:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:104:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:105:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:106:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:107:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:108:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:109:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:110:11:
    Not in scope: data constructor ‘DEMO’

src/Text/ParserCombinators/UU/Demo/Examples.hs:111:11:
    Not in scope: data constructor ‘DEMO’
cabal: Leaving directory '/var/folders/hc/98p9h4tj67b2zvnr2zbmg2_r0000gn/T/cabal-tmp-17434/uu-parsinglib-2.7.4.3'
Completed    attoparsec-0.13.2.4
Completed    haskell-src-exts-1.20.3
cabal: Error: some packages failed to install:
HarmTrace-Base-1.4.0.1-E2utJuigfJU9TJbNodq6XT depends on
HarmTrace-Base-1.4.0.1 which failed to install.
uu-parsinglib-2.7.4.3-BnfDYkqunLjFMHWw4iokbw failed during the building phase.
The exception was:
ExitFailure 1

谁能帮我吗?

4

1 回答 1

2

让我们看一些相关的位src/Text/ParserCombinators/UU/Demo/Examples.hs

{-# LANGUAGE  FlexibleInstances,
              TypeSynonymInstances,
              MultiParamTypeClasses,
              Rank2Types, FlexibleContexts, NoMonomorphismRestriction,
              CPP  #-}

CPP应该启用 C 预处理器。

#define DEMO(p,i) demo "p" i p

这应该用DEMO不会导致这些错误的正确代码替换出现。

show_demos :: IO ()
show_demos = 
       do DEMO (pa,  "a")
          DEMO (pa,  "" )
          DEMO (pa,  "b")
          DEMO (((++) <$> pa <*> pa), "bbab")
          DEMO (pa,  "ba")
          DEMO (pa,  "aa")
          DEMO ((pCount pa :: Parser Int),                                 "aaa")
          DEMO ((do  {l <- pCount pa; pExact l pb}),                       "aaacabbbbb")
          DEMO ((amb ( (++) <$> pa2 <*> pa3 <|> (++) <$> pa3 <*> pa2)),    "aaaaa")
          DEMO ((pList pLower),                                            "doaitse")
          DEMO (paz,                                                       "abc2ez")
          DEMO ((max <$> pParens ((+1) <$> wfp) <*> wfp `opt` 0),          "((()))()(())")
          DEMO ((pa <|> pb <?> justamessage),                              "c")
          DEMO ((amb (pEither  parseIntString  pIntList)),                 "(123;456;789)")
--          DEMO ((pa *> pMunch ( `elem` "^=*") <* pb),                      "a^=^**^^b")

但显然这些并没有被替换,因为你得到了这些错误。我的猜测是您的 GHC 版本真的很旧,因为在 6.8.1 之前,CPP不支持。尝试更新到较新的 GHC。

于 2020-04-01T04:31:33.197 回答