无法使用ffmpeg-light编译项目

时间:2016-10-26 22:22:11

标签: haskell ffmpeg

使用openFileCodec.FFmpeg.Decode函数的任何项目的编译都失败并显示错误:

Couldn't match type ‘GHC.IO.Exception.IOException’ with ‘[Char]’ arising from a functional dependency between: constraint ‘mtl-2.2.1:Control.Monad.Error.Class.MonadError String IO’ arising from a use of ‘openFile’ instance ‘mtl-2.2.1:Control.Monad.Error.Class.MonadError GHC.IO.Exception.IOException IO’ at <no location info>

例如,编译失败:

openVideoFile :: String -> IO ()
openVideoFile filePath = do

  initFFmpeg

  avFmtCtx <- openFile filePath

  return ()

我想原因是MonadError String IO没有现成的实例。但是,当我添加这样的虚拟实例时:

instance MonadError String IO where
  throwError _   = undefined
  catchError _ _ = undefined

我收到了另一个错误:

Functional dependencies conflict between instance declarations: instance MonadError String IO -- Defined at src/Video/Play/Base.hs:20:10 instance [safe] MonadError GHC.IO.Exception.IOException IO -- Defined in ‘Control.Monad.Error.Class’

我不知道如何强制编译器在这里使用MonadError String IO实例。

0 个答案:

没有答案