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