Haskell 包构建错误

标签 haskell cabal haskell-platform hakyll

我创建了一个 cabal 沙箱,并尝试在我的 OSX 上构建 hakyll Haskell 包,但我在临时包 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

最佳答案

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

由于维护者没有及时响应,暂时没有对 hackage 进行更新,有人创建了 temporary-rc暂时叉一下。

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

  1. 通过cabal get temporary-rc将temporary-rc下载到临时文件夹
  2. 编辑temporary-rc.cabal并将“name:”字段(第一行)从“temporary-rc”更改为“temporary”
  3. 我正在使用沙箱,所以如果您使用的话,请执行 cabal sandbox add-source <path/to/temporary-rc> (上一步中临时目录中的临时-rc 文件夹)
    • 如果您不使用沙箱,我想您可以执行 cabal install从临时 rc 文件夹中将其安装到您的用户 package-db 中。我还没有测试过这个。
  4. 正常安装 hakyll,它应该会获取修改后的“临时”软件包。

如果您想在家跟随,可以使用 thread on haskell-libraries讨论情况。

关于Haskell 包构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23572396/

相关文章:

haskell - Cabal中的变量(Haskell)

haskell - 如何使用 cabal new-test 流式传输测试结果?

haskell - GHC 中派生的 Eq 实例的效率如何?

haskell - 在 Haskell 中,为什么即使启用了 AllowAmbiguousTypes 类型也会有歧义?

Haskell:检查列表中的第一个元素是否重复

固定长度的 Haskell powerset 子列表

haskell - Haskell 中的奇怪返回

haskell - Haskell 中的推导是如何进行的?

haskell - 我如何告诉 cabal 为我的程序的依赖项之一指定依赖项?

haskell - 离线安装和运行 haskell 包