Skip to content

Data.Text.Lazy.takeWhileEnd is broken #184

Description

@bucklereed

With text-1.2.2.2:

*Main> import qualified Data.Text as T
*Main T> T.takeWhileEnd isSpace $ "foobar"
""
*Main T> T.null . T.takeWhileEnd isSpace $ "foobar"
True
*Main T> import qualified Data.Text.Lazy as LT
*Main T LT> LT.takeWhileEnd isSpace $ "foobar"
""
*Main T LT> LT.null . LT.takeWhileEnd isSpace $ "foobar"
False
*Main T LT> LT.length . LT.takeWhileEnd isSpace $ "foobar"
0

As can be seen, strict Text gives the expected results; lazy Text constructs a very weird thing that has zero length, looks empty, but is not null. The bug is possibly in Data.Text.Lazy.null rather than takeWhileEnd?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions