@@ -1,3 +1,4 @@
1+{-# LANGUAGE OverloadedStrings #-}
12module Main (main) where
23
34import Control.Monad (forM_)
@@ -10,6 +11,7 @@ import Test.Framework.Providers.QuickCheck2 (testProperty)
1011import Test.QuickCheck hiding (NonEmpty)
1112import qualified Data.Attoparsec as P
1213import qualified Data.ByteString as B
14+import qualified Data.ByteString.Char8 as C
1315
1416-- Make sure that structures whose types claim they are non-empty
1517-- really are.
@@ -63,9 +65,10 @@ takeWhile (w,s) =
6365 P.Done t' h' -> t == t' && h == h'
6466 _ -> False
6567
66−takeWhile1 (w, NonEmpty s) =
67− let (h,t) = B.span (==w) s
68− in case defP (P.takeWhile1 (==w)) s of
68+takeWhile1 (w, s) =
69+ let s' = B.cons w s
70+ (h,t) = B.span (<=w) s'
71+ in case defP (P.takeWhile1 (<=w)) s' of
6972 P.Done t' h' -> t == t' && h == h'
7073 _ -> False
7174