You can do this quite easily with the binary package. You can find the documentation for reading files here .
It already includes a way to deserialize a list of 32-bit integers, so you just need to call the decodeFile function. For clarity, you can have a typical version:
decodeIntsFile :: FilePath -> IO [Int32] decodeIntsFile = decodeFile
Then, if you want your list of integers to be an array, use the appropriate array transformation, for example listArray .
source share