Unable to build package due to ambiguous foreplay

I am trying to install BNF converter from cabal, however there is a problem with creating it. Apparently, this package uses a combination of modules from haskell98 and version 4. * of the database. This creates a problem in that if you compile with haskell98, then some modules will not be found. However, if you are compiling with haskell98, then ghc cannot determine whether it should use the new Prelude or haskell98 Prelude!

Error message:

Main.hs:1:1: Ambiguous module name `Prelude': it was found in multiple packages: base haskell98-2.0.0.1 

How do you resolve such errors?

+4
source share
1 answer

Ask companions to download the patch. Or, if they do not respond, consider taking on the service yourself.

This is because haskell98 is a compatibility package that duplicates functions in other modules. New code should not depend on it, unless that means compatibility with Haskell-98. However, this change is relatively recent, and many old codes refer to both "base" and "haskell98", although in fact it does not use the "haskell98" package.

In the short term, I started cabal unpack BNFC and then edited the ".cabal" file and removed the haskell98 link from the "build-depends:" field. I would also hit the version number for the library (this step does not matter for executables). Then create and install from the local copy that you just edited. Other problems may arise if BNFC was to use mtl version 1, but you can add this restriction yourself if necessary.

+7
source

Source: https://habr.com/ru/post/1403972/


All Articles