@@ -1,3 +1,4 @@
1+{-# LANGUAGE OverloadedStrings #-}
1module Main (main) where
2module Main (main) where
3import Control.Monad (forM_)
4import Control.Monad (forM_)
@@ -10,6 +11,7 @@ import Test.Framework.Providers.QuickCheck2 (testProperty)
10import Test.QuickCheck hiding (NonEmpty)
11import Test.QuickCheck hiding (NonEmpty)
11import qualified Data.Attoparsec as P
12import qualified Data.Attoparsec as P
12import qualified Data.ByteString as B
13import qualified Data.ByteString as B
14+import qualified Data.ByteString.Char8 as C
14-- Make sure that structures whose types claim they are non-empty
16-- Make sure that structures whose types claim they are non-empty
15-- really are.
17-- really are.
@@ -63,9 +65,10 @@ takeWhile (w,s) =
63 P.Done t' h' -> t == t' && h == h'
65 P.Done t' h' -> t == t' && h == h'
64 _ -> False
66 _ -> False
66−takeWhile1 (w, NonEmpty s) =
68+takeWhile1 (w, s) =
67− let (h,t) = B.span (==w) s
70+ (h,t) = B.span (<=w) s'
68− in case defP (P.takeWhile1 (==w)) s of
71+ in case defP (P.takeWhile1 (<=w)) s' of
69 P.Done t' h' -> t == t' && h == h'
72 P.Done t' h' -> t == t' && h == h'
70 _ -> False
73 _ -> False