vincenthz / hs-connection

simple client connection library in haskell with builtin features: SSL/TLS, SOCKS, session management.
Other
61 stars 48 forks source link

Error compiling connection-0.3.0 #39

Closed annacrombie closed 5 years ago

annacrombie commented 5 years ago

Issue

When I try to compile connection (a dependency of xmobar, which is what I am trying to install), I get a compilation error.

Machine info

$ uname -a
Linux kuro 4.14.83-gentoo #6 SMP Fri Feb 15 20:45:56 -00 2019 x86_64 Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz GenuineIntel GNU/Linux
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.2
$ cabal --version
cabal-install version 1.24.0.2
compiled using version 1.24.2.0 of the Cabal library

Build log

Build log ( /home/lattis/.cabal/logs/connection-0.3.0.log ):
cabal: Entering directory '/tmp/cabal-tmp-18567/connection-0.3.0'
Configuring connection-0.3.0...
Building connection-0.3.0...
Preprocessing library connection-0.3.0...
[1 of 2] Compiling Network.Connection.Types ( Network/Connection/Types.hs, dist/build/Network/Connection/Types.o )
[2 of 2] Compiling Network.Connection ( Network/Connection.hs, dist/build/Network/Connection.o )

Network/Connection.hs:213:22: error:
    • No instance for (Read PortNumber) arising from a use of ‘reads’
    • In the expression: reads portS
      In the expression:
        case reads portS of {
          [(sPort, "")] -> Just (sHost, sPort)
          _ -> Nothing }
      In a case alternative:
          (sHost, ':' : portS)
            -> case reads portS of {
                 [(sPort, "")] -> Just (sHost, sPort)
                 _ -> Nothing }
cabal: Leaving directory '/tmp/cabal-tmp-18567/connection-0.3.0'

Steps to reproduce

$ cabal install xmobar
vincenthz commented 5 years ago

what's your network library version ? recommended fix at the moment is to use stack instead of cabal which use overall package versions that works together

blackgnezdo commented 5 years ago

I hit this too using network-2.6.2.1 which is within the bounds specified by connection.cabal (>=2.6). Apparently the Read instance was first added in 2.6.3 series.

% cabal v2-repl
Build profile: -w ghc-8.6.4 -O1
In order, the following will be built (use -v for more details):
 - connection-0.3.0 (first run)
Preprocessing library for connection-0.3.0..
GHCi, version 8.6.4: http://www.haskell.org/ghc/  :? for help
[1 of 2] Compiling Network.Connection.Types ( Network/Connection/Types.hs, interpreted )
[2 of 2] Compiling Network.Connection ( Network/Connection.hs, interpreted )

Network/Connection.hs:213:22: error:
    * No instance for (Read PortNumber) arising from a use of `reads'
    * In the expression: reads portS
      In the expression:
        case reads portS of
          [(sPort, "")] -> Just (sHost, sPort)
          _ -> Nothing
      In a case alternative:
          (sHost, ':' : portS)
            -> case reads portS of
                 [(sPort, "")] -> Just (sHost, sPort)
                 _ -> Nothing
    |
213 |                 case reads portS of
    |                      ^^^^^^^^^^^
Failed, one module loaded.
*Network.Connection.Types> :info PortNumber
newtype PortNumber
  = network-2.6.2.1:Network.Socket.Types.PortNum GHC.Word.Word16
        -- Defined in `network-2.6.2.1:Network.Socket.Types'
instance Eq PortNumber
  -- Defined in `network-2.6.2.1:Network.Socket.Types'
instance Ord PortNumber
  -- Defined in `network-2.6.2.1:Network.Socket.Types'
instance Show PortNumber
  -- Defined in `network-2.6.2.1:Network.Socket.Types'
instance Enum PortNumber
  -- Defined in `network-2.6.2.1:Network.Socket.Types'
instance Num PortNumber
  -- Defined in `network-2.6.2.1:Network.Socket.Types'
instance Real PortNumber
  -- Defined in `network-2.6.2.1:Network.Socket.Types'
instance Integral PortNumber
  -- Defined in `network-2.6.2.1:Network.Socket.Types'
*Network.Connection.Types>