Created
June 23, 2016 03:43
-
-
Save antekone/7ea2b120a7cc4922853cc8d09722e933 to your computer and use it in GitHub Desktop.
This file contains 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
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