Permalink
Browse files

Replaced Stream instance by instance from Text by Text.Parsec.Text. B…

…umped version number. Bumped minimal required version of Parsec.
  • Loading branch information...
1 parent 54031d9 commit 34dc4745b77b9c2a593b55d62ddb5d38ddb22d5d @Palmik Palmik committed Feb 6, 2012
Showing with 15 additions and 16 deletions.
  1. +14 −15 src/Text/XmlHtml/TextParser.hs
  2. +1 −1 xmlhtml.cabal
@@ -2,7 +2,19 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
-module Text.XmlHtml.TextParser where
+module Text.XmlHtml.TextParser
+( guessEncoding
+, parse
+, isValidChar
+, parseText
+, takeWhile0
+, takeWhile1
+, text
+, scanText
+, ScanState(..)
+
+, module Text.Parsec.Text
+) where
import Control.Applicative
import Data.Char
@@ -12,13 +24,12 @@ import Text.XmlHtml.Common
import Data.Text (Text)
import qualified Data.Text as T
-import Text.Parsec (Parsec)
import qualified Text.Parsec as P
+import Text.Parsec.Text
import Data.ByteString (ByteString)
import qualified Data.ByteString as B
-
------------------------------------------------------------------------------
-- | Get an initial guess at document encoding from the byte order mark. If
-- the mark doesn't exist, guess UTF-8. Otherwise, guess according to the
@@ -30,18 +41,6 @@ guessEncoding b
| B.take 2 b == B.pack [ 0xFF, 0xFE ] = (UTF16LE, B.drop 2 b)
| otherwise = (UTF8, b)
-
-------------------------------------------------------------------------------
--- | Specialized type for the parsers we use here.
-type Parser = Parsec Text ()
-
-
-------------------------------------------------------------------------------
--- An (orphaned) instance for parsing Text with Parsec.
-instance (Monad m) => P.Stream T.Text m Char where
- uncons = return . T.uncons
-
-
------------------------------------------------------------------------------
parse :: (Encoding -> Parser a) -> String -> ByteString -> Either String a
parse p src b = let (e, b') = guessEncoding b
View
@@ -823,7 +823,7 @@ Library
blaze-html >= 0.3.2 && < 0.5,
bytestring >= 0.9 && < 0.10,
containers >= 0.3 && < 0.5,
- parsec >= 3.0 && < 3.2,
+ parsec >= 3.1 && < 3.2,
text >= 0.11 && < 0.12,
unordered-containers >= 0.1.4 && < 0.2

0 comments on commit 34dc474

Please sign in to comment.