如何使用任何一个字符串(io())

发布于 2025-02-13 04:56:06 字数 752 浏览 0 评论 0原文

我正在与Haskell的Juicy Pixels库一起工作,我想制作一个gif动画,并使用 image pixelrgb8 的列表。有一个功能可以执行此操作(tringifanimation),但是它返回了我不知道如何使用的类型(ctring(io(io()))。 有人可以帮我吗?

我正在使用它的方式: tringifanimation“ test.gif” 1 loopingforever image_list

错误:与预期类型'io()'与实际类型'contere type'contery type'contrate'String(io(io())'

the库文档: https://hackage.haskell.org/package/juicypixels-3.3.7/docs/codec-picture.html#v:savepngimage:最大%3A%20filepath%20%2D%3E

I'm working with Juicy Pixels library in Haskell and i want to make a GIF animation with a list of image PixelRGB8. There's a function that do that (writeGifAnimation), but it returns a type that i don't know how to use (Either String (IO())).
Can anybody help me?

The way i'm using it:
writeGifAnimation "test.gif" 1 LoopingForever image_list

The error: Couldn't match expected type ‘IO ()’ with actual type ‘Either String (IO ())’

The library documentation:
https://hackage.haskell.org/package/JuicyPixels-3.3.7/docs/Codec-Picture.html#v:savePngImage:~:text=the%20same%20delay.-,writeGifAnimation,-%3A%3A%20FilePath%20%2D%3E

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江湖正好 2025-02-20 04:56:06

您应该检查是否是使用s一个错误,还是对i使用 i i 代码> io()操作,所以:

main :: IO ()
main = do
    -- …
    case writeGifAnimation "test.gif" 1 LoopingForever image_list of
        Left s -> fail s
        Right i -> i
    -- …

You should check whether it is a Left s with s an error, or a Right i with i an IO () action, so:

main :: IO ()
main = do
    -- …
    case writeGifAnimation "test.gif" 1 LoopingForever image_list of
        Left s -> fail s
        Right i -> i
    -- …
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文