Question

Recently I tried to install fpco-api on OS X 10.9 via cabal install, but got errors during the building phase. Here is the list of error:

... lots of 'loading package'
Loading package asn1-data-0.7.1 ... linking ... done.
Loading package asn1-types-0.2.3 ... linking ... done.
Loading package crypto-pubkey-types-0.4.1 ... linking ... done.
Loading package pem-0.2.1 ... linking ... done.
Loading package certificate-1.3.9 ... linking ... done.
Loading package publicsuffixlist-0.1 ... linking ... done.
Loading package regex-base-0.93.2 ... linking ... done.
Loading package regex-posix-0.95.2 ... linking ... done.
Loading package regex-compat-0.95.1 ... linking ... done.
Loading package socks-0.5.4 ... linking ... done.
Loading package crypto-numbers-0.2.3 ... linking ... done.
Loading package crypto-pubkey-0.2.4 ... linking ... done.
Loading package tls-1.1.5 ... linking ... done.
Loading package cipher-rc4-0.1.4 ... linking ... done.
Loading package tls-extra-0.6.6 ... linking ... done.
Loading package http-conduit-1.9.6 ... linking ... done.
Loading package hslogger-1.2.3 ... linking ... done.
Loading package MissingH-1.2.0.2 ... linking ... done.
Loading package ConfigFile-1.1.1 ... linking ... done.
[ 5 of 10] Compiling FP.API.Run ( src/library/FP/API/Run.hs, dist/build/FP/API/Run.o )

src/library/FP/API/Run.hs:37:1: Warning:
Module `Prelude' does not export `catch'
[ 6 of 10] Compiling FP.API.TH ( src/library/FP/API/TH.hs, dist/build/FP/API/TH.o )
[ 7 of 10] Compiling FP.Server.Types ( src/library/FP/Server/Types.hs, dist/build/FP/Server/Types.o )

src/library/FP/Server/Types.hs:97:36:
Ambiguous occurrence `Loc'
It could refer to either `FP.Server.Types.Loc',
defined at src/library/FP/Server/Types.hs:115:6
or `Control.Monad.Logger.Loc',
imported from `Control.Monad.Logger' at src/library/FP/Server/Types.hs:18:1-27
(and originally defined in `Language.Haskell.TH.Syntax')

src/library/FP/Server/Types.hs:102:46:
Ambiguous occurrence `Loc'
It could refer to either `FP.Server.Types.Loc',
defined at src/library/FP/Server/Types.hs:115:6
or `Control.Monad.Logger.Loc',
imported from `Control.Monad.Logger' at src/library/FP/Server/Types.hs:18:1-27
(and originally defined in `Language.Haskell.TH.Syntax')

src/library/FP/Server/Types.hs:103:46:
Ambiguous occurrence `Loc'
It could refer to either `FP.Server.Types.Loc',
defined at src/library/FP/Server/Types.hs:115:6
or `Control.Monad.Logger.Loc',
imported from `Control.Monad.Logger' at src/library/FP/Server/Types.hs:18:1-27
(and originally defined in `Language.Haskell.TH.Syntax')

src/library/FP/Server/Types.hs:118:17:
Ambiguous occurrence `Loc'
It could refer to either `FP.Server.Types.Loc',
defined at src/library/FP/Server/Types.hs:115:6
or `Control.Monad.Logger.Loc',
imported from `Control.Monad.Logger' at src/library/FP/Server/Types.hs:18:1-27
(and originally defined in `Language.Haskell.TH.Syntax')

src/library/FP/Server/Types.hs:119:19:
Ambiguous occurrence `Loc'
It could refer to either `FP.Server.Types.Loc',
defined at src/library/FP/Server/Types.hs:115:6
or `Control.Monad.Logger.Loc',
imported from `Control.Monad.Logger' at src/library/FP/Server/Types.hs:18:1-27
(and originally defined in `Language.Haskell.TH.Syntax')
Failed to install fpco-api-1.0.5
cabal: Error: some packages failed to install:
fpco-api-1.0.5 failed during the building phase. The exception was:
ExitFailure 1

Does anyone know how to handle this error?

Was it helpful?

Solution

It seems that the monad-logger package started to export the Loc symbol starting with version 0.3.4.0. This version isn't excluded by the Cabal file of fpco-api.

You could try

cabal install fpco-api --constraint="monad-logger < 0.3.4"

to force using an older version of monad-logger.


More explanation about the error:

The module FP.Server.Types in the package fpco-api defines a datatype Loc that's used throughout the package. The module Language.Haskell.TH.Syntax defines a different datatype Loc. This modules isn't used directly by fpco-api, but fpco-api makes use of the monad-logger package, which in turn uses Language.Haskell.TH.Syntax. That's no problem as long as at no point in the program, both different Loc types are in scope. But in its most recent version, 0.3.4.0, the monad-logger package decided to re-export the Loc datatype from Language.Haskell.TH.Syntax. Now in many places where the logger monad is imported in fpco-api, suddenly both Loc types are in scope, and GHC doesn't know to which one the local occurrences of Loc refer.

The proper fix for this error is for fpco-api to be hiding the Loc re-export from the logger monad, or to explicitly refer to the right one by using qualified names. But this requires a source code update of fpco-api. The temporary fix to use an older version of monad-logger should hopefully be sufficient.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top