#4157: A bug of dropWhileR in Data.Sequence
---------------------------------+------------------------------------------
Reporter: kazu-yamamoto | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries (other)
Version: 6.12.3 | Keywords:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
The document of dropWhileR says: dropWhileR p xs is equivalent to reverse
(dropWhileL p (reverse xs)).
However,
reverse $ dropWhileL (==4) $ reverse $ fromList [1,2,3,4]
==> fromList [1,2,3]
dropWhileR (==4) $ fromList [1,2,3,4]
==> fromList [1,2]
I guess the cause of bug is in breakl.
Original:
breakl p xs = foldr (\ i _ -> S.splitAt i xs) (xs, empty) (findIndicesL p
xs)
Fixed:
breakl p xs = foldr (\ i _ -> S.splitAt (i+1) xs) (xs, empty)
(findIndicesL p xs)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4157>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs