[Haskell-cafe] Data.ByteString.dropWhile

Thomas Conway drtomc at gmail.com
Tue Jul 10 02:15:55 EDT 2007


So the following isn't as clever as the line-noise Don posted, but
should be in the ball-park.

dropFromEnds p = dropWhile p . dropWhileEnd p

dropWhileEnd p bs = take (findFromEndUntil (not p) bs) bs

takeWhileEnd p bs = drop (findFromEndUntil p bs) bs

{- findFromEndUntil is in ByteString.hs, but is not exported -}

T.
-- 
Dr Thomas Conway
drtomc at gmail.com

Silence is the perfectest herald of joy:
I were but little happy, if I could say how much.


More information about the Haskell-Cafe mailing list