Skip to content

Instantly share code, notes, and snippets.

@lamvak
Forked from anonymous/gist:5355148
Last active December 16, 2015 01:29
Show Gist options
  • Save lamvak/5355152 to your computer and use it in GitHub Desktop.
Save lamvak/5355152 to your computer and use it in GitHub Desktop.
module Main where
import System.IO.MMap
import qualified Data.ByteString.Lazy as BL
somedata:: IO BL.ByteString
somedata = mmapFileByteStringLazy "some.data" Nothing
main = somedata >>= return . show . BL.last >>= putStrLn
{- some.data file is 1625424 bytes long (in case that matters)
- the code crashes with a nasty segfault
-}
@lamvak
Copy link
Author

lamvak commented Apr 10, 2013

And just changing somedata to BL.readFile "some.data" does the job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment