[Haskell-cafe] dropSpace not exported in ByteString

Don Stewart dons at galois.com
Thu Nov 15 17:24:00 EST 2007

>    Hi all,
>    I'm writing a Haskell program to do some address cleansing. The program
>    uses the ByteString library.
>    Data.ByteString.Char8 documentations shows functions for removing
>    whitespace from start or end of a ByteString. Those functions are said to
>    be more efficient than the dropWhile / reverse mixes.
>    It looks exactly like what I'm searching for, but apparently those
>    functions are not exported by the Data.ByteString.Char8 module. Are those
>    functions only called by rules? Transformation of dropWhile isSpace into
>    dropSpace? I've seen such a rule for dropSpace but did not found an
>    equivalent rule for dropSpaceEnd.
>    Is there a way to call the dropSpace and dropSpaceEnd or do I have to code
>    with dropWhile and hope that some rule will magically transform my
>    dropWhileS into dropSpaceS?

The latter:

        "FPS specialise dropWhile isSpace -> dropSpace"
                dropWhile isSpace = dropSpace

check that the rule fires with -ddump-simpl-stats

There's no rule for dropSpaceEnd, but you can certainly inline the defn
in your code, if perf. matters.

-- Don

More information about the Haskell-Cafe mailing list