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?
With text-1.2.2.2:
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?