-- | Binary IO.

module Agda.Utils.IO.Binary
  ( readBinaryFile'
  ) where

import System.IO
import Data.ByteString.Lazy as BS

-- | Returns a close function for the file together with the contents.

readBinaryFile' :: FilePath -> IO (ByteString, IO ())
readBinaryFile' :: FilePath -> IO (ByteString, IO ())
readBinaryFile' FilePath
file = do
    Handle
h <- FilePath -> IOMode -> IO Handle
openBinaryFile FilePath
file IOMode
ReadMode
    ByteString
s <- Handle -> IO ByteString
BS.hGetContents Handle
h
    (ByteString, IO ()) -> IO (ByteString, IO ())
forall (m :: * -> *) a. Monad m => a -> m a
return (ByteString
s, Handle -> IO ()
hClose Handle
h)