I'm using Gentoo Linux and I have the network package installed:
$ equery l network
[IP-] [ ] dev-haskell/network-3.0.1.1:0/3.0.1.1
$ ls -la /usr/lib64/x86_64-linux-ghc-8.10.4/libHSnetwork-3.0.1.1-...-ghc8.10.4.so
-rwxr-xr-x 1 root root 705152 12. Nov 04:58 /usr/lib64/x86_64-linux-ghc-8.10.4/libHSnetwork-3.0.1.1-...-ghc8.10.4.so
There is no newer Gentoo package in the standard repository. But there are newer versions in Cabal. I even managed to install the newest one locally:
$ ls -la ~/.cabal/store/ghc-8.10.4/network-3.1.2.5-.../lib/libHSnetwork-3.1.2.5-...-ghc8.10.4.so
-rwxr-xr-x 1 jdoe jdoe 1610088 28. Nov 02:52 /home/jdoe/.cabal/store/ghc-8.10.4/network-3.1.2.5-.../lib/libHSnetwork-3.1.2.5-...-ghc8.10.4.so
I need this newst one to compile another package, but when I try to compile that, I still get the same error. Asking for the installed version yields:
$ cabal list --installed network
* network
Synopsis: Low-level networking interface
Default available version: 3.1.2.5
Installed versions: 3.0.1.1
Homepage: https://github.com/haskell/network
License: BSD3
What can I do to make Cabal aware that it has the newer version installed locally?
I try to compile Monky https://github.com/monky-hs/monky.git. First, the error message is
Monky/MPD.hs:222:10: error:
Variable not in scope:
unsafeFdSocket :: MPDSock -> IO Foreign.C.Types.CInt
|
222 | Fd <$> unsafeFdSocket s
| ^^^^^^^^^^^^^^
I found that unsafeFdSocket
is defined since network-3.1.1, therefore I changed the lines around 222 to:
#if MIN_VERSION_network(3,1,1)
Fd <$> unsafeFdSocket s
#else
pure . Fd $ fdSocket s
#endif
Now the error message says:
Monky/MPD.hs:224:15: error:
• Couldn't match expected type ‘Foreign.C.Types.CInt’
with actual type ‘IO Foreign.C.Types.CInt’
• In the second argument of ‘($)’, namely ‘fdSocket s’
In the expression: pure . Fd $ fdSocket s
In an equation for ‘getMPDFd’:
getMPDFd (MPDSocket s) = pure . Fd $ fdSocket s
|
224 | pure . Fd $ fdSocket s
| ^^^^^^^^^^