peek package:pipes-parse

peek checks the first element of the stream, but uses unDraw to push the element back so that it is available for the next draw command.
peek = do
x <- draw
case x of
Nothing -> return ()
Just a  -> unDraw a
return x