Bonard B. Timmons III writes:
> Hi,
>
> Why is dropPS for PackedString not completely analogous to drop for
> String? For example,
>
> drop 5 "hello" yields ""
>
> whereas
>
> unpackPS (dropPS 5 (packString "hello")) yields "hello"
>
> Given the straightforward source of dropPS below, this inconsistency
> seems to be more a feature than a bug.
>
>
> dropPS :: Int -> PackedString -> PackedString
> dropPS (I# n) ps
> | n ==# len = ps
> | otherwise = substrPS# ps n (lengthPS# ps -# 1#)
> where
> len = lengthPS# ps
>
That looks like a typo, the RHS of the first guard should say nilPS
not ps.
Thanks,
--Sigbjorn