문제

I'm trying to use network-conduit as a backend for (patched) HaskellNet's IMAP. One of the required operations is to detect if the stream is open. Currently I'm using

isOpen :: (Monad m) => ConduitM i o m Bool
isOpen = await >>= maybe (return False) ((True <$) . leftover)

Is this correct, or is there a better way?

도움이 되었습니까?

해결책

That's correct, the only possible improvement is you could use the peek helper function, but what you have here is fine.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top