@@ -1,4 +1,6 @@
1−{-# LANGUAGE BangPatterns, Rank2Types, OverloadedStrings, RecordWildCards #-}
1+{-# LANGUAGE BangPatterns, FlexibleInstances, OverloadedStrings, Rank2Types,
2+ RecordWildCards, TypeSynonymInstances #-}
3+{-# OPTIONS_GHC -fno-warn-orphans #-}
24-- |
35-- Module : Data.Attoparsec.Text.Internal
46-- Copyright : Bryan O'Sullivan 2011
@@ -64,6 +66,7 @@ import Control.Applicative ((<|>), (<$>))
6466import Control.Monad (when)
6567import Data.Attoparsec.Combinator
6668import Data.Attoparsec.Internal.Types hiding (Parser, Input, Added, Failure, Success)
69+import Data.String (IsString(..))
6770import Data.Text (Text)
6871import Prelude hiding (getChar, take, takeWhile)
6972import qualified Data.Attoparsec.Internal.Types as T
@@ -78,6 +81,9 @@ type Added = T.Added Text
7881type Failure r = T.Failure Text r
7982type Success a r = T.Success Text a r
8083
84+instance IsString (Parser Text) where
85+ fromString = string . T.pack
86+
8187-- | If at least @n@ characters of input are available, return the
8288-- current input, otherwise fail.
8389ensure :: Int -> Parser Text