Small bug in Data.PackedString.splitWithPS

Simon Marlow simonmar at microsoft.com
Mon Jan 13 06:30:40 EST 2003


> In GHC 5.04.2 this fails: wordsPS (packString "a")
> 
> Cause: typical off-by-one error in libraries/base/Data/PackedString.hs
>     line 289
> 
> first_pos_that_satisfies pred ps len n =
>    case [ m | m <- [n..len], pred (ps ! m) ] of
>                          ^
>                         here
> 
> Probably should be:
>    case [ m | m <- [n..len-1], pred (ps ! m) ] of

Thanks; fixed.

Cheers,
	Simon



More information about the Glasgow-haskell-bugs mailing list