diff --git a/Text/Parsec/Combinator.hs b/Text/Parsec/Combinator.hs
--- a/Text/Parsec/Combinator.hs
+++ b/Text/Parsec/Combinator.hs
@@ -275,12 +275,3 @@
                       scan  = do{ end; return [] }
                             <|>
                               do{ x <- p; xs <- scan; return (x:xs) }
-
--- | @lookAhead p@ parses @p@ without consuming any input.
-
-lookAhead :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m a
-lookAhead p         = do{ state <- getParserState
-                        ; x <- p
-                        ; setParserState state
-                        ; return x
-                        }
diff --git a/Text/Parsec/Error.hs b/Text/Parsec/Error.hs
--- a/Text/Parsec/Error.hs
+++ b/Text/Parsec/Error.hs
@@ -134,8 +134,12 @@
     = ParseError pos (msg : filter (msg /=) msgs)
 
 mergeError :: ParseError -> ParseError -> ParseError
-mergeError (ParseError pos msgs1) (ParseError _ msgs2)
-    = ParseError pos (msgs1 ++ msgs2)
+mergeError (ParseError pos1 msgs1) (ParseError pos2 msgs2)
+    = case pos1 `compare` pos2 of
+        -- select the longest match
+        EQ -> ParseError pos1 (msgs1 ++ msgs2)
+        GT -> ParseError pos1 msgs1
+        LT -> ParseError pos2 msgs2
 
 instance Show ParseError where
     show err
diff --git a/Text/Parsec/Prim.hs b/Text/Parsec/Prim.hs
--- a/Text/Parsec/Prim.hs
+++ b/Text/Parsec/Prim.hs
@@ -37,6 +37,7 @@
     , (<|>)
     , label
     , labels
+    , lookAhead
     , Stream(..)
     , tokens
     , try
@@ -432,9 +433,23 @@
 
 try :: ParsecT s u m a -> ParsecT s u m a
 try p =
-    ParsecT $ \s@(State _ pos _) cok _ eok eerr ->
-    let pcerr parseError = eerr $ setErrorPos pos parseError 
-    in unParser p s cok pcerr eok eerr
+    ParsecT $ \s cok _ eok eerr ->
+    unParser p s cok eerr eok eerr
+
+-- | @lookAhead p@ parses @p@ without consuming any input.
+--
+-- If @p@ fails and consumes some input, so does @lookAhead@. Combine with 'try'
+-- if this is undesirable.
+
+lookAhead :: (Stream s m t) => ParsecT s u m a -> ParsecT s u m a
+lookAhead p         = do{ state <- getParserState
+                        ; x <- p'
+                        ; setParserState state
+                        ; return x
+                        }
+    where
+    p' = ParsecT $ \s cok cerr eok eerr ->
+         unParser p s eok cerr eok eerr
 
 -- | The parser @tokenPrim showTok posFromTok testTok@ accepts a token @t@
 -- with result @x@ when the function @testTok t@ returns @'Just' x@. The
diff --git a/Text/Parsec/Text.hs b/Text/Parsec/Text.hs
new file mode 100644
--- /dev/null
+++ b/Text/Parsec/Text.hs
@@ -0,0 +1,31 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Text.Parsec.String
+-- Copyright   :  (c) Antoine Latter 2011
+-- License     :  BSD-style (see the file libraries/parsec/LICENSE)
+-- 
+-- Maintainer  :  aslatter@gmail.com
+-- Stability   :  provisional
+-- Portability :  portable
+-- 
+-- Make Text an instance of 'Stream' with 'Char' token type.
+--
+-----------------------------------------------------------------------------
+
+{-# LANGUAGE FlexibleInstances #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module Text.Parsec.Text
+    ( Parser, GenParser
+    ) where
+
+import qualified Data.Text as Text
+import Text.Parsec.Error
+import Text.Parsec.Prim
+
+instance (Monad m) => Stream Text.Text m Char where
+    uncons = return . Text.uncons
+    {-# INLINE uncons #-}
+
+type Parser = Parsec Text.Text ()
+type GenParser st = Parsec Text.Text st
diff --git a/Text/Parsec/Text/Lazy.hs b/Text/Parsec/Text/Lazy.hs
new file mode 100644
--- /dev/null
+++ b/Text/Parsec/Text/Lazy.hs
@@ -0,0 +1,31 @@
+-----------------------------------------------------------------------------
+-- |
+-- Module      :  Text.Parsec.String
+-- Copyright   :  (c) Antoine Latter 2011
+-- License     :  BSD-style (see the file libraries/parsec/LICENSE)
+-- 
+-- Maintainer  :  aslatter@gmail.com
+-- Stability   :  provisional
+-- Portability :  portable
+-- 
+-- Make Text an instance of 'Stream' with 'Char' token type.
+--
+-----------------------------------------------------------------------------
+
+{-# LANGUAGE FlexibleInstances #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
+
+module Text.Parsec.Text.Lazy
+    ( Parser, GenParser
+    ) where
+
+import qualified Data.Text.Lazy as Text
+import Text.Parsec.Error
+import Text.Parsec.Prim
+
+instance (Monad m) => Stream Text.Text m Char where
+    uncons = return . Text.uncons
+    {-# INLINE uncons #-}
+
+type Parser = Parsec Text.Text ()
+type GenParser st = Parsec Text.Text st
diff --git a/Text/Parsec/Token.hs b/Text/Parsec/Token.hs
--- a/Text/Parsec/Token.hs
+++ b/Text/Parsec/Token.hs
@@ -658,10 +658,10 @@
                             GT  -> False
 
     theReservedNames
-        | caseSensitive languageDef  = sortedNames
-        | otherwise               = map (map toLower) sortedNames
+        | caseSensitive languageDef  = sort reserved
+        | otherwise                  = sort . map (map toLower) $ reserved
         where
-          sortedNames   = sort (reservedNames languageDef)
+          reserved = reservedNames languageDef
 
 
 
diff --git a/parsec3.cabal b/parsec3.cabal
--- a/parsec3.cabal
+++ b/parsec3.cabal
@@ -1,5 +1,5 @@
 name:           parsec3
-version:        1.0.0.3
+version:        1.0.0.4
 cabal-version: >= 1.2.3
 license:        BSD3
 license-file:   LICENSE
@@ -23,19 +23,19 @@
         versions, therefore I do not recommend to unconditionally use parsec3
         as dependency in cabal files of packages for hackage.  But you may
         want to develop your code using this subset of parsec3 modules and
-        finally change the dependency from parsec3 to parsec-3.1.1 in order to
+        finally change the dependency from parsec3 to parsec in order to
         avoid module ambiguities for users just installing your package.  Your
         own module ambiguities are best avoided by hiding packages.
         .
-        This version has only a changed description compared to parsec3-1.0.0.2
-        that does not re-exports parts of the Applicative module to stay compatible with
-        parsec-3.1.1
+        This version reflects the changes of parsec-3.1.2
 library
     exposed-modules:
         Text.Parsec,
         Text.Parsec.String,
         Text.Parsec.ByteString,
         Text.Parsec.ByteString.Lazy,
+        Text.Parsec.Text,
+        Text.Parsec.Text.Lazy,
         Text.Parsec.Pos,
         Text.Parsec.Error,
         Text.Parsec.Prim,
@@ -45,6 +45,6 @@
         Text.Parsec.Expr,
         Text.Parsec.Language,
         Text.Parsec.Perm
-    build-depends: base >= 4 && < 5, mtl, bytestring
+    build-depends: base >= 4 && < 5, mtl, bytestring, text >= 0.2 && < 0.12
     extensions: DeriveDataTypeable, PolymorphicComponents, FlexibleInstances,
         MultiParamTypeClasses, FlexibleContexts
