Permalink
Browse files

Fix examples build.

  • Loading branch information...
1 parent 366e4b1 commit dd548bf0708f19d1961705720895b8da877710c4 @yihuang committed Aug 30, 2012
Showing with 10 additions and 14 deletions.
  1. +8 −12 Highlight.hs
  2. +2 −2 Parse.hs
View
20 Highlight.hs
@@ -1,21 +1,17 @@
-import Data.Maybe
import System.IO
import System.Environment
-import Text.HTML.TagStream
+import System.Console.ANSI
+
+import Data.Maybe
import Data.ByteString (ByteString)
import qualified Data.ByteString.Char8 as S
-import System.Console.ANSI
+
+import Data.Conduit.Blaze (builderToByteString)
import qualified Data.Conduit as C
import qualified Data.Conduit.Binary as CB
import qualified Data.Conduit.List as CL
-import Blaze.ByteString.Builder (Builder)
-import Data.Conduit.Blaze (builderToByteString)
-
-encodeHL :: (ByteString -> ByteString) -> [Token] -> ByteString
-encodeHL hl = B.toByteString . mconcat . map (showToken hl)
-encode :: [Token] -> ByteString
-encode = encodeHL id
+import qualified Text.HTML.TagStream.ByteString as S
color :: Color -> ByteString -> ByteString
color c s = S.concat [ S.pack $ setSGRCode [SetColor Foreground Dull c]
@@ -29,7 +25,7 @@ main = do
filename <- maybe (fail "Highlight file") return (listToMaybe args)
C.runResourceT $
CB.sourceFile filename
- C.$= tokenStream
- C.$= CL.map (showToken (color Red))
+ C.$= S.tokenStream
+ C.$= CL.map (S.showToken (color Red))
C.$= builderToByteString
C.$$ CB.sinkHandle stdout
View
4 Parse.hs
@@ -1,6 +1,6 @@
import Data.Maybe
import System.Environment
-import Text.HTML.TagStream
+import qualified Text.HTML.TagStream.ByteString as S
import qualified Data.Conduit as C
import qualified Data.Conduit.Binary as C
import qualified Data.Conduit.List as CL
@@ -11,6 +11,6 @@ main = do
filename <- maybe (fail "pass file path") return (listToMaybe args)
_ <- C.runResourceT $
C.sourceFile filename
- C.$= tokenStream
+ C.$= S.tokenStream
C.$$ CL.consume
return ()

0 comments on commit dd548bf

Please sign in to comment.