My print statement keeps throwing error, don't really understand what is going on.
import Data.ByteString.Lazy as BS
import Data.Word
import Data.Bits
readByte :: String -> IO [Word8]
readByte fp = do
contents <- BS.readFile fp
return $ Prelude.take 5 $ unpack contents
main :: IO ()
main = do
input <- readByte "DATA.BIN"
print "Byte 0: " ++ [input!!0]
Getting the below error:
Couldn't match expected type `[()]' with actual type `IO ()'
In the return type of a call of `print'
In the first argument of `(++)', namely `print "Byte 0: "'
printisn't "throwing [an] error", that would imply you are executing the program. What is happening is the compiler is emitting a type checking error regarding the print statement.