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

笑着哭i 提交于 2020-01-06 13:58:25

问题


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:


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.



来源:https://stackoverflow.com/questions/26912029/haskell-http-conduit-1-9-6-no-instance-for-read-utctime-compilation-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!