ignoreWhile :: Monad m => (a -> Bool) -> C.Conduit a m a
ignoreWhile pr = loop
    where loop = C.await >>= maybe (return ())
                                   (\val -> if pr val
                                               then loop
                                               else C.leftover val >> C.awaitForever C.yield
                                    )
                                   
-- | Pipes all the the values from upstream while the predicate holds. Complement to `ignoreWhile`.
-- Example:
--
-- >>> sourceList [1..10] $= isolateWhile (< 3) $$ consume
-- [1, 2]
ignoreWhile :: Monad m => (a -> Bool) -> C.Conduit a m a
ignoreWhile pr = loop
    where loop = C.await >>= maybe (return ())
                                   (\val -> if pr val
                                               then loop
                                               else C.leftover val >> C.awaitForever C.yield
                                    )
                                   
-- | Pipes all the the values from upstream while the predicate holds. Complement to `ignoreWhile`.
-- Example:
--
-- >>> sourceList [1..10] $= isolateWhile (< 3) $$ consume
-- [1, 2]
ignoreWhile pr = loop
    where loop = C.await >>= maybe (return ())
                                   (\val -> if pr val
                                               then loop
                                               else C.leftover val >> C.awaitForever C.yield
                                    )
                                   
-- | Pipes all the the values from upstream while the predicate holds. Complement to `ignoreWhile`.
-- Example:
--
-- >>> sourceList [1..10] $= isolateWhile (< 3) $$ consume
-- [1, 2]