Notes about problems I had and what I did about them.
gusdev@d6a1d607e6fe:~$ cabal install newtype-generics-0.5.2.2
Resolving dependencies...
Downloading newtype-generics-0.5.2.2...
Failed to install newtype-generics-0.5.2.2
Build log ( /home/gusdev/.cabal/logs/newtype-generics-0.5.2.2.log ):
/home/gusdev/.cabal/logs/newtype-generics-0.5.2.2.log: openFile: does not
exist (No such file or directory)
It meant that newtype-generics-0.5.2.2
failed to download. Indeed my mirror (hackage.reesd.com) was not up-to-date.
Downloading hledger-1.2...
Configuring hledger-1.2...
Building hledger-1.2...
Failed to install hledger-1.2
Build log ( /home/gusdev/.cabal/logs/hledger-1.2.log ):
cabal: Entering directory '/tmp/cabal-tmp-1506/hledger-1.2'
Configuring hledger-1.2...
Building hledger-1.2...
Preprocessing library hledger-1.2...
[ 1 of 23] Compiling Text.Tabular.AsciiWide ( Text/Tabular/AsciiWide.hs, dist/build/Text/Tabular/AsciiWide.o )
[ 2 of 23] Compiling Paths_hledger ( dist/build/autogen/Paths_hledger.hs, dist/build/Paths_hledger.o )
[ 3 of 23] Compiling Hledger.Cli.Version ( Hledger/Cli/Version.hs, dist/build/Hledger/Cli/Version.o )
[ 4 of 23] Compiling Hledger.Cli.DocFiles ( Hledger/Cli/DocFiles.hs, dist/build/Hledger/Cli/DocFiles.o )
Hledger/Cli/DocFiles.hs:37:6: error:
* Exception when trying to run compile-time code:
/tmp/cabal-tmp-1506/hledger-1.2/doc/hledger.1: hGetContents: invalid argument (invalid byte sequence)
Code: (>>=) makeRelativeToProject "doc/hledger.1" embedStringFile
* In the untyped splice:
$(makeRelativeToProject "doc/hledger.1" >>= embedStringFile)
cabal: Leaving directory '/tmp/cabal-tmp-1506/hledger-1.2'
Exporting the LANG environment variable did the trick (here, using a Dockerfile):
ENV LANG=en_US.UTF-8
gusdev@ad10b59b282f:~$ ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Prelude> :l reesd-debug/bin/
.reesd-debug.hs.swp reesd-debug.hs
Prelude> :l reesd-debug/bin/reesd-debug.hs
[1 of 1] Compiling Main ( reesd-debug/bin/reesd-debug.hs, interpreted )
reesd-debug/bin/reesd-debug.hs:24:36: error:
• No instance for (Control.Monad.State.Class.MonadState
Postgres (Handler b Postgres))
arising from a use of ‘get’
• In the second argument of ‘with’, namely ‘get’
In the expression: with database get
In an equation for ‘getPostgresState’:
getPostgresState = with database get
Failed, modules loaded: none.
Loading (above) the script in GHCi was failing, but compiling it (via cabal install
) was succeeding. I found out that hding mtl-2.2.2 (and exposing mtl-2.2.1) was resolving the problem, e.g. something like this in the ghci.conf
file:
:set -hide-package mtl-2.2.2
:set -package mtl-2.2.1
Both of them were available in my stack:8.0.2
image; I have to find out why.