Skip to content

Instantly share code, notes, and snippets.

@antekone
Created June 23, 2016 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antekone/7ea2b120a7cc4922853cc8d09722e933 to your computer and use it in GitHub Desktop.
Save antekone/7ea2b120a7cc4922853cc8d09722e933 to your computer and use it in GitHub Desktop.
import qualified Data.ByteString.Lazy as BL
import Data.Binary.Get
import Data.Word
readArray :: Get [Word8]
readArray = do
empty <- isEmpty
if empty
then return []
else do
byte <- getWord8
rest <- readArray
return (byte : rest)
main :: IO ()
main = do
input <- BL.getContents
print $ map (\ x -> x+1) $ take 5 $ runGet readArray input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment