-
-
Save lamvak/5355152 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
-} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
And just changing somedata to BL.readFile "some.data" does the job.