saveRastimation :: FilePath -> Rastimation -> IO ()
saveRastimation dir (Rastimation frames) = do
    createDirectoryIfMissing True dir
    -- Check existence, to give better error messages
    e <- doesDirectoryExist dir
    when (not e)
        (throwIO . ErrorCall $ errStr ("directory does not exist: " ++ dir))

    let go :: Int -> Raster -> IO (IO ())
        go i img = spawn $ saveRaster (dir </> printf "%08d.png" i) img

    zipWithM go [0..] (F.toList frames) >>= sequence_
saveRastimation :: FilePath -> Rastimation -> IO ()
saveRastimation dir (Rastimation frames) = do
    createDirectoryIfMissing True dir
    -- Check existence, to give better error messages
    e <- doesDirectoryExist dir
    when (not e)
        (throwIO . ErrorCall $ errStr ("directory does not exist: " ++ dir))

    let go :: Int -> Raster -> IO (IO ())
        go i img = spawn $ saveRaster (dir </> printf "%08d.png" i) img

    zipWithM go [0..] (F.toList frames) >>= sequence_
saveRastimation dir (Rastimation frames) = do
    createDirectoryIfMissing True dir
    -- Check existence, to give better error messages
    e <- doesDirectoryExist dir
    when (not e)
        (throwIO . ErrorCall $ errStr ("directory does not exist: " ++ dir))

    let go :: Int -> Raster -> IO (IO ())
        go i img = spawn $ saveRaster (dir </> printf "%08d.png" i) img

    zipWithM go [0..] (F.toList frames) >>= sequence_