Dependency hell in Haskell (cabal, uu-parsinglib)

114 Views Asked by At

I'm trying to compile a Haskell program that is a few years old and really isn't maintained anymore. It has a long list of dependencies that have required me to install an older version of uu-parsinglib. Specifically, it has computed that it wants uu-parsinglib-2.7.4.3, but I'm getting a strange compilation error. I'm a fairly experienced programmer, but not in Haskell, so I'm a little in the dark here. Cabal is giving me the following error:

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

Can anyone help me out?

1

There are 1 best solutions below

1
On

Let's look at a few relevant bits of src/Text/ParserCombinators/UU/Demo/Examples.hs:

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

CPP is supposed to enable the C preprocessor.

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

This is supposed to replace the occurrences of DEMO with the right code that wouldn't cause those errors.

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")

But clearly these aren't being replaced, since you are getting those errors. My guess is that your GHC version is really really old, since prior to 6.8.1, CPP wasn't supported. Try updating to a newer GHC.