Skip to content

Data.ByteString.break seems to interpret the predicate backwards #275

@Yuras

Description

@Yuras

According to the docs it should return the longest prefix which does not satisfy the predicate. In ghci:

ghci> Data.ByteString.break (== 32) "hello world"
("hello"," world")
ghci> Data.ByteString.break (/= 32) "hello world"
("","hello world")

MicroHs does the opposite:

> Data.ByteString.break (== 32) "hello world"
("","hello world")
> Data.ByteString.break (/= 32) "hello world"
("hello"," world")

I discovered the issue by running the test suite of scanner package: Yuras/scanner#14
I'm also missing Data.ByteString.Unsafe (scanner uses only unsafeChrunsafeDrop from it, so not a big deal) and the whole Data.ByteString.Lazy thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions