Biggest concern right now is that it doesn't appear very lazy. I'm not sure how the compiler will actually shake it out, but in pureland some sort of takeWhile seems like the best solution. Not sure if that will be applicable here.
But it works!
too many coments!
-- If the byte was a newline,
rest <- if first == B.pack "\n"
These lines are just the same, why write it twice? Other are also too obvious. Try to document nuances, not the codeflow.
@danbst I agree. I was initially worried about having no comments. I think I've struck more of a balance now! The first one may seem obvious, but I'm thinking of people who aren't familiar with the serialport library.