Haskell http-conduit-1.9.6 "No instance for (Read UTCTime)" compilation error

142 views Asked by At

I'm trying to install http-conduit-1.9.6 (my Haskell application needs that version), and my "cabal install http-conduit-1.9.6" gives me the following error:

Building http-conduit-1.9.6...
Preprocessing library http-conduit-1.9.6...
[ 1 of 12] Compiling Network.HTTP.Conduit.Util ( Network/HTTP/Conduit/Util.hs, dist/build/Network/HTTP/Conduit/Util.o )
[ 2 of 12] Compiling Network.HTTP.Conduit.ConnInfo ( Network/HTTP/Conduit/ConnInfo.hs, dist/build/Network/HTTP/Conduit/ConnInfo.o )
[ 3 of 12] Compiling Network.HTTP.Conduit.Types ( Network/HTTP/Conduit/Types.hs, dist/build/Network/HTTP/Conduit/Types.o )

Network/HTTP/Conduit/Types.hs:239:13:

No instance for (Read UTCTime)  
  arising from the 'deriving' clause of a data type declaration  
Possible fix:
  add an instance declaration for (Read UTCTime)
  or use a standalone 'deriving instance' declaration,
       so you can specify the instance context yourself
When deriving the instance for (Read Cookie)

Failed to install http-conduit-1.9.6
cabal: Error: some packages failed to install:
http-conduit-1.9.6 failed during the building phase. The exception was:
ExitFailure 1

My work platform is Ubuntu 14.04 and cabal 1.20 Thanks.

1

There are 1 answers

0
obadz On

To build http-conduit-1.9.6 (in a sandbox), I've had to:

  1. Explicitly add a dependency on network-uri in the build-depends of the http-conduit.cabal

  2. In Network/HTTP/Conduit/Types.hs, replace the import Data.Time.Clock by import Data.Time

    (this issue in the time package put me on the right track: https://github.com/haskell/time/issues/7)

Let me know if that doesn't do it.