Fuad Abdallah writes:
> Hello,
> 
> i just encountered the following strange result with PackedStrings:
> 
> foo = packString "this is a test"
> 
> show (filterPS (not.isSpace) foo)
> 
> result:
> 
> "thisisatest\NUL"
> 
> It looks like the trailing \0 from the PS is filtered ?
> 

thanks, an off-by-oner. Patch appended - recompiling hslibs/ghc should
do it.

--Sigbjorn

*** hslibs/ghc/src/PackedString.lhs.~4~ Tue Sep 23 11:49:57 1997
--- hslibs/ghc/src/PackedString.lhs     Tue Oct 14 20:04:42 1997
***************
*** 609,615 ****
       -}
       runST (
         let
!         (rle,len_filtered) = filter_ps len# 0# 0# []
        len_filtered#      = case len_filtered of { I# x# -> x#}
         in
         if len# ==# len_filtered# then 
--- 609,615 ----
       -}
       runST (
         let
!         (rle,len_filtered) = filter_ps (len# -# 1#) 0# 0# []
        len_filtered#      = case len_filtered of { I# x# -> x#}
         in
         if len# ==# len_filtered# then 

Reply via email to