Haskell包构建错误

时间:2014-05-09 19:22:46

标签: haskell cabal haskell-platform hakyll

我创建了一个cabal沙箱,我正在尝试在我的OSX上构建hakyll Haskell包,但是我在包temporary-1.2.0.2上遇到了构建错误。可能是什么原因?
cabal版本是1.20
构建错误如下:

abcdef-MacBook-Pro:hakyll bd$ cabal install temporary
Resolving dependencies...
Configuring temporary-1.2.0.2...
Building temporary-1.2.0.2...
Preprocessing library temporary-1.2.0.2...
[1 of 3] Compiling Distribution.Compat.Exception ( Distribution/Compat/Exception.hs, dist/dist-sandbox-352cd149/build/Distribution/Compat/Exception.o )
[2 of 3] Compiling Distribution.Compat.TempFile ( Distribution/Compat/TempFile.hs, dist/dist-sandbox-352cd149/build/Distribution/Compat/TempFile.o )
[3 of 3] Compiling System.IO.Temp   ( System/IO/Temp.hs, dist/dist-sandbox-352cd149/build/System/IO/Temp.o )

System/IO/Temp.hs:59:3:
    Could not deduce (MonadMask m) arising from a use of `bracket'
    from the context (MonadIO m, MonadCatch m)
      bound by the type signature for
                 withTempFile :: (MonadIO m, MonadCatch m) =>
                                 FilePath -> String -> (FilePath -> Handle -> m a) -> m a
      at System/IO/Temp.hs:(53,17)-(57,19)
    Possible fix:
      add (MonadMask m) to the context of
        the type signature for
          withTempFile :: (MonadIO m, MonadCatch m) =>
                          FilePath -> String -> (FilePath -> Handle -> m a) -> m a
    In the expression:
      bracket
        (liftIO (openTempFile tmpDir template))
        (\ (name, handle)
           -> liftIO (hClose handle >> ignoringIOErrors (removeFile name)))
        (uncurry action)
    In an equation for `withTempFile':
        withTempFile tmpDir template action
          = bracket
              (liftIO (openTempFile tmpDir template))
              (\ (name, handle)
                 -> liftIO (hClose handle >> ignoringIOErrors (removeFile name)))
              (uncurry action)

System/IO/Temp.hs:79:3:
    Could not deduce (MonadMask m) arising from a use of `bracket'
    from the context (MonadCatch m, MonadIO m)
      bound by the type signature for
                 withTempDirectory :: (MonadCatch m, MonadIO m) =>
                                      FilePath -> String -> (FilePath -> m a) -> m a
      at System/IO/Temp.hs:(73,22)-(77,24)
    Possible fix:
      add (MonadMask m) to the context of
        the type signature for
          withTempDirectory :: (MonadCatch m, MonadIO m) =>
                               FilePath -> String -> (FilePath -> m a) -> m a
    In the expression:
      bracket
        (liftIO (createTempDirectory targetDir template))
        (liftIO . ignoringIOErrors . removeDirectoryRecursive)
    In an equation for `withTempDirectory':
        withTempDirectory targetDir template
          = bracket
              (liftIO (createTempDirectory targetDir template))
              (liftIO . ignoringIOErrors . removeDirectoryRecursive)
Failed to install temporary-1.2.0.2
cabal: Error: some packages failed to install:
temporary-1.2.0.2 failed during the building phase. The exception was:
ExitFailure 1

1 个答案:

答案 0 :(得分:2)

这是由于“临时”包中存在错误:https://github.com/batterseapower/temporary/pull/12

由于维护者没有响应,因此暂时没有对hackage进行临时更新,并且有人暂时创建了temporary-rc分叉。

据我所知,'临时'依赖是来自pandoc和pandoc-citeproc。我能够通过执行以下操作来安装hakyll,这相当hacky但对我有用,并且不需要下载和修改一堆软件包来使用'temporary-rc'而不是'temporary'。

  1. 通过cabal get temporary-rc
  2. 将temporary-rc下载到临时文件夹
  3. 编辑temporary-rc.cabal并将“name:”字段(第一行)从'temporary-rc'更改为'temporary'
  4. 我正在使用沙箱,所以如果你是,请执行cabal sandbox add-source <path/to/temporary-rc>(从最后一步开始临时目录中的temporary-rc文件夹)
    • 如果您没有使用沙盒,我想您可以从temporary-rc文件夹中执行cabal install将其安装到您的用户包-db中。我没有测试过这个。
  5. 正常安装hakyll,它应该选择修改后的'临时'包。
  6. 如果你想在家里跟随,有一个thread on haskell-libraries讨论情况。