Commits

Anonymous committed 7143fa3

Fixed tests and benchmark

  • Participants
  • Parent commits e29b8ab

Comments (0)

Files changed (2)

benchmarks/Tiny.hs

   forM_ args $ \arg -> do
     input <- B.readFile arg
     case A.parse p input `A.feed` B.empty of
-      A.Done _ xs -> print (length xs)
-      what        -> print what
+      A.Done _ _ xs -> print (length xs)
+      what          -> print what
  where
   slow = A.many (A.many1 A.letter <|> A.many1 A.digit)
   fast = A.many (A.takeWhile1 isLetter <|> A.takeWhile1 isDigit)
 -- Basic byte-level combinators.
 
 maybeP p s = case P.parse p s `P.feed` B.empty of
-               P.Done _ i -> Just i
-               _          -> Nothing
+               P.Done _ _ i -> Just i
+               _            -> Nothing
 
 defP p s = P.parse p s `P.feed` B.empty
 
 skipWhile w s =
     let t = B.dropWhile (<=w) s
     in case defP (P.skipWhile (<=w)) s of
-         P.Done t' () -> t == t'
-         _            -> False
+         P.Done t' _ () -> t == t'
+         _              -> False
 
 takeCount (Positive k) s =
     case maybeP (P.take k) s of
 takeWhile w s =
     let (h,t) = B.span (==w) s
     in case defP (P.takeWhile (==w)) s of
-         P.Done t' h' -> t == t' && h == h'
-         _            -> False
+         P.Done t' _ h' -> t == t' && h == h'
+         _              -> False
 
 takeWhile1 w s =
     let s'    = B.cons w s
         (h,t) = B.span (<=w) s'
     in case defP (P.takeWhile1 (<=w)) s' of
-         P.Done t' h' -> t == t' && h == h'
-         _            -> False
+         P.Done t' _ h' -> t == t' && h == h'
+         _              -> False
 
 takeTill w s =
     let (h,t) = B.break (==w) s
     in case defP (P.takeTill (==w)) s of
-         P.Done t' h' -> t == t' && h == h'
-         _            -> False
+         P.Done t' _ h' -> t == t' && h == h'
+         _              -> False
 
 ensure n s = case defP (P.ensure m) s of
-               P.Done _ () -> B.length s >= m
-               _           -> B.length s < m
+               P.Done _ _ () -> B.length s >= m
+               _             -> B.length s < m
     where m = (n `mod` 220) - 20
 
 takeWhile1_empty = maybeP (P.takeWhile1 undefined) B.empty == Nothing