<div dir="ltr">Hello,<div><br></div><div>I have a small piece of code that does not compile and I'm having trouble figuring out why.</div><div><br></div><div>Here is the relevant snippet:</div><div><br></div><div>readChunks :: Handle -> [String] -> IO [String]</div><div>readChunks handle accum = do</div><div>  chunk <- readHeaderChunk handle</div><div>  if isLast chunk</div><div>    then return (accum ++ chunk)</div><div>    else return (readChunks handle (accum ++ chunk))</div><div><br></div><div><div>isLast :: [String] -> Bool</div></div><div><br></div><div><div>readHeaderChunk :: Handle -> IO [String]</div></div><div><br></div><div>And here is the single compiler error:</div><div><br></div><div><div>hacks.hs:48:18:</div><div>    Couldn't match expected type `[String]'</div><div>                with actual type `IO [String]'</div><div>    In the return type of a call of `readChunks'</div><div>    In the first argument of `return', namely</div><div>      `(readChunks handle (accum ++ chunk))'</div><div>    In the expression: return (readChunks handle (accum ++ chunk))</div></div><div><br></div><div>What I'm most confused about is that chunk is passed to isLast as a [String] with no compiler error but cannot be passed to accum ++ chunk that way. Or so it seems. Can someone she some light on this? Thanks.</div></div>