[Haskell-cafe] How to safely and fast write repa array to a file?

Henning Thielemann lemming at henning-thielemann.de
Fri Apr 3 04:21:26 UTC 2020


On Thu, 2 Apr 2020, cyberfined via Haskell-Cafe wrote:

> writeImage :: FilePath -> Image -> IO ()
> writeImage path img = bracket (openFile path WriteMode) (hClose) $ \hdl -> B.hPut hdl header >> B.hPut hdl body

Btw. the bracket thing is equivalent to
    withFile path WriteMode


More information about the Haskell-Cafe mailing list