Commits

Bryan O'Sullivan committed 2756e39

Example fiddle faddle.

Comments (0)

Files changed (2)

examples/Parsec_RFC2616.hs

-{-# LANGUAGE BangPatterns, FlexibleContexts #-}
+{-# LANGUAGE BangPatterns, CPP, FlexibleContexts #-}
 
 module Main (main) where
 
 import Control.Exception (bracket)
 import System.Environment (getArgs)
 import System.IO (hClose, openFile, IOMode(ReadMode))
-import Text.Parsec.ByteString (Parser, parseFromFile)
 import Text.Parsec.Char (anyChar, char, satisfy, string)
 import Text.Parsec.Combinator (many1, manyTill, skipMany1)
 import Text.Parsec.Prim hiding (many, token, (<|>))
+import qualified Data.IntSet as S
+
+#if 1
+import Text.Parsec.ByteString.Lazy (Parser, parseFromFile)
+import qualified Data.ByteString.Lazy as B
+#else
+import Text.Parsec.ByteString (Parser, parseFromFile)
 import qualified Data.ByteString as B
-import qualified Data.IntSet as S
+#endif
 
 token :: Stream s m Char => ParsecT s u m Char
 token = satisfy $ \c -> S.notMember (fromEnum c) set

examples/TestRFC2616.hs

 import qualified Data.ByteString.Char8 as B
 import Data.Attoparsec
 
-refill h = B.hGet h 4096
+refill h = B.hGet h (4*1024)
 
 listy file h = do
   r <- parseWith (refill h) (many request) =<< refill h