-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Extension of the parsers library with more capability and efficiency
--   
--   Extended version of the parsers library, with the additional classes
--   providing more capable and efficient methods.
@package input-parsers
@version 0.3.0.2

-- | A parser's position in the input.
module Text.Parser.Input.Position

-- | A class for representing position values. The methods satisfy these
--   laws:
--   
--   
--   move (distance pos1 pos2) pos1 == pos2
--   (pos1 < pos2) == (distance pos1 pos2 > 0)
--   
class Ord p => Position p

-- | Distance from the first position to the second
distance :: Position p => p -> p -> Int

-- | Move the position by the given distance.
move :: Position p => Int -> p -> p

-- | Map the position into its offset from the beginning of the full input.
offset :: (Position p, FactorialMonoid s) => s -> p -> Int

-- | Construct a Position given the offset from the beginning of the
--   full input.
fromStart :: Int -> Int

-- | Construct a Position given the length remaining from the
--   position to the end of the input.
fromEnd :: Int -> Down Int

-- | Given the parser input, a Position within it, and desired
--   number of context lines, returns a description of the offset position
--   in English.
context :: (Eq s, TextualMonoid s, Position p) => s -> p -> Int -> s

-- | Given the full input and an offset within it, returns all the input
--   lines up to and including the offset in reverse order, as well as the
--   zero-based column number of the offset
lineAndColumn :: (Eq s, IsString s, FactorialMonoid s, Position p) => s -> p -> ([s], Int)
instance Text.Parser.Input.Position.Position a => Text.Parser.Input.Position.Position (GHC.Internal.Data.Ord.Down a)
instance Text.Parser.Input.Position.Position GHC.Types.Int

-- | Newtype wrappers for parsers
module Text.Parser.Wrapper

-- | Wrapper that signifies lazy ByteString inputs
newtype Lazy (f :: Type -> Type) a
Lazy :: f a -> Lazy (f :: Type -> Type) a
[getLazy] :: Lazy (f :: Type -> Type) a -> f a

-- | Wrapper that signifies strict ByteString inputs
newtype Strict (f :: Type -> Type) a
Strict :: f a -> Strict (f :: Type -> Type) a
[getStrict] :: Strict (f :: Type -> Type) a -> f a
instance GHC.Internal.Base.Alternative f => GHC.Internal.Base.Alternative (Text.Parser.Wrapper.Lazy f)
instance GHC.Internal.Base.Alternative f => GHC.Internal.Base.Alternative (Text.Parser.Wrapper.Strict f)
instance GHC.Internal.Base.Applicative f => GHC.Internal.Base.Applicative (Text.Parser.Wrapper.Lazy f)
instance GHC.Internal.Base.Applicative f => GHC.Internal.Base.Applicative (Text.Parser.Wrapper.Strict f)
instance Text.Parser.Char.CharParsing f => Text.Parser.Char.CharParsing (Text.Parser.Wrapper.Lazy f)
instance Text.Parser.Char.CharParsing f => Text.Parser.Char.CharParsing (Text.Parser.Wrapper.Strict f)
instance GHC.Classes.Eq (f a) => GHC.Classes.Eq (Text.Parser.Wrapper.Lazy f a)
instance GHC.Classes.Eq (f a) => GHC.Classes.Eq (Text.Parser.Wrapper.Strict f a)
instance GHC.Internal.Base.Functor f => GHC.Internal.Base.Functor (Text.Parser.Wrapper.Lazy f)
instance GHC.Internal.Base.Functor f => GHC.Internal.Base.Functor (Text.Parser.Wrapper.Strict f)
instance Text.Parser.LookAhead.LookAheadParsing f => Text.Parser.LookAhead.LookAheadParsing (Text.Parser.Wrapper.Lazy f)
instance Text.Parser.LookAhead.LookAheadParsing f => Text.Parser.LookAhead.LookAheadParsing (Text.Parser.Wrapper.Strict f)
instance GHC.Internal.Base.MonadPlus f => GHC.Internal.Base.MonadPlus (Text.Parser.Wrapper.Lazy f)
instance GHC.Internal.Base.MonadPlus f => GHC.Internal.Base.MonadPlus (Text.Parser.Wrapper.Strict f)
instance GHC.Internal.Base.Monad f => GHC.Internal.Base.Monad (Text.Parser.Wrapper.Lazy f)
instance GHC.Internal.Base.Monad f => GHC.Internal.Base.Monad (Text.Parser.Wrapper.Strict f)
instance GHC.Classes.Ord (f a) => GHC.Classes.Ord (Text.Parser.Wrapper.Lazy f a)
instance GHC.Classes.Ord (f a) => GHC.Classes.Ord (Text.Parser.Wrapper.Strict f a)
instance Text.Parser.Combinators.Parsing f => Text.Parser.Combinators.Parsing (Text.Parser.Wrapper.Lazy f)
instance Text.Parser.Combinators.Parsing f => Text.Parser.Combinators.Parsing (Text.Parser.Wrapper.Strict f)
instance GHC.Internal.Read.Read (f a) => GHC.Internal.Read.Read (Text.Parser.Wrapper.Lazy f a)
instance GHC.Internal.Read.Read (f a) => GHC.Internal.Read.Read (Text.Parser.Wrapper.Strict f a)
instance GHC.Internal.Show.Show (f a) => GHC.Internal.Show.Show (Text.Parser.Wrapper.Lazy f a)
instance GHC.Internal.Show.Show (f a) => GHC.Internal.Show.Show (Text.Parser.Wrapper.Strict f a)
instance Text.Parser.Token.TokenParsing f => Text.Parser.Token.TokenParsing (Text.Parser.Wrapper.Lazy f)
instance Text.Parser.Token.TokenParsing f => Text.Parser.Token.TokenParsing (Text.Parser.Wrapper.Strict f)

-- | Parsers that can consume and return a prefix of their input.
module Text.Parser.Input

-- | Methods for parsing monoidal inputs
class LookAheadParsing m => InputParsing (m :: Type -> Type) where {
    
    -- | The type of the input stream that the parser <tt>m</tt> expects to
    --   parse.
    type ParserInput (m :: Type -> Type);
    type ParserPosition (m :: Type -> Type);
    type ParserPosition m :: Type -> Type = Down Int;
}

-- | Always sucessful parser that returns the entire remaining input
--   without consuming it.
getInput :: InputParsing m => m (ParserInput m)

-- | Retrieve the Position reached by the parser in the input
--   source.
getSourcePos :: InputParsing m => m (ParserPosition m)
($dmgetSourcePos) :: (InputParsing m, FactorialMonoid (ParserInput m), Functor m, ParserPosition m ~ Down Int) => m (ParserPosition m)

-- | A parser that accepts any single atomic prefix of the input stream.
--   
--   
--   anyToken == satisfy (const True)
--   anyToken == take 1
--   
anyToken :: InputParsing m => m (ParserInput m)

-- | A parser that accepts exactly the given number of input atoms.
--   
--   
--   take n == count n anyToken
--   
take :: InputParsing m => Int -> m (ParserInput m)

-- | A parser that accepts an input atom only if it satisfies the given
--   predicate.
satisfy :: InputParsing m => (ParserInput m -> Bool) -> m (ParserInput m)
($dmsatisfy) :: (InputParsing m, Monad m) => (ParserInput m -> Bool) -> m (ParserInput m)

-- | A parser that succeeds exactly when satisfy doesn't, equivalent to
--   notFollowedBy . satisfy
notSatisfy :: InputParsing m => (ParserInput m -> Bool) -> m ()

-- | A stateful scanner. The predicate modifies a state argument, and each
--   transformed state is passed to successive invocations of the predicate
--   on each token of the input until one returns Nothing or the
--   input ends.
--   
--   This parser does not fail. It will return an empty string if the
--   predicate returns Nothing on the first character.
--   
--   Note: Because this parser does not fail, do not use it with
--   combinators such as many, because such parsers loop until a
--   failure occurs. Careless use will thus result in an infinite loop.
scan :: InputParsing m => state -> (state -> ParserInput m -> Maybe state) -> m (ParserInput m)
($dmscan) :: (InputParsing m, Monad m, FactorialMonoid (ParserInput m)) => state -> (state -> ParserInput m -> Maybe state) -> m (ParserInput m)

-- | A parser that consumes and returns the given prefix of the input.
string :: InputParsing m => ParserInput m -> m (ParserInput m)
($dmstring) :: (InputParsing m, Monad m, LeftReductive (ParserInput m), FactorialMonoid (ParserInput m), Show (ParserInput m)) => ParserInput m -> m (ParserInput m)

-- | A parser accepting the longest sequence of input atoms that match the
--   given predicate; an optimized version of concat .
--   many . satisfy.
--   
--   Note: Because this parser does not fail, do not use it with
--   combinators such as many, because such parsers loop until a
--   failure occurs. Careless use will thus result in an infinite loop.
takeWhile :: InputParsing m => (ParserInput m -> Bool) -> m (ParserInput m)
($dmtakeWhile) :: (InputParsing m, Monad m, FactorialMonoid (ParserInput m)) => (ParserInput m -> Bool) -> m (ParserInput m)

-- | A parser accepting the longest non-empty sequence of input atoms that
--   match the given predicate; an optimized version of concat
--   . some . satisfy.
takeWhile1 :: InputParsing m => (ParserInput m -> Bool) -> m (ParserInput m)
($dmtakeWhile1) :: (InputParsing m, Monad m, FactorialMonoid (ParserInput m)) => (ParserInput m -> Bool) -> m (ParserInput m)

-- | Methods for parsing textual monoid inputs
class (CharParsing m, InputParsing m) => InputCharParsing (m :: Type -> Type)

-- | Specialization of satisfy on textual inputs, accepting an input
--   character only if it satisfies the given predicate, and returning the
--   input atom that represents the character. Equivalent to fmap
--   singleton . Char.satisfy
satisfyCharInput :: InputCharParsing m => (Char -> Bool) -> m (ParserInput m)

-- | A parser that succeeds exactly when satisfy doesn't, equivalent to
--   notFollowedBy . Char.satisfy
notSatisfyChar :: InputCharParsing m => (Char -> Bool) -> m ()

-- | Stateful scanner like scan, but specialized for
--   TextualMonoid inputs.
scanChars :: InputCharParsing m => state -> (state -> Char -> Maybe state) -> m (ParserInput m)
($dmscanChars) :: (InputCharParsing m, Monad m, TextualMonoid (ParserInput m)) => state -> (state -> Char -> Maybe state) -> m (ParserInput m)

-- | Specialization of takeWhile on TextualMonoid inputs,
--   accepting the longest sequence of input characters that match the
--   given predicate; an optimized version of fmap fromString . many .
--   Char.satisfy.
--   
--   Note: Because this parser does not fail, do not use it with
--   combinators such as many, because such parsers loop until a
--   failure occurs. Careless use will thus result in an infinite loop.
takeCharsWhile :: InputCharParsing m => (Char -> Bool) -> m (ParserInput m)
($dmtakeCharsWhile) :: (InputCharParsing m, Monad m, TextualMonoid (ParserInput m)) => (Char -> Bool) -> m (ParserInput m)

-- | Specialization of takeWhile1 on TextualMonoid inputs,
--   accepting the longest sequence of input characters that match the
--   given predicate; an optimized version of fmap fromString . some .
--   Char.satisfy.
takeCharsWhile1 :: InputCharParsing m => (Char -> Bool) -> m (ParserInput m)
($dmtakeCharsWhile1) :: (InputCharParsing m, Monad m, TextualMonoid (ParserInput m)) => (Char -> Bool) -> m (ParserInput m)

-- | Parsers that keep track of the consumed input.
class InputParsing m => ConsumedInputParsing (m :: Type -> Type)

-- | Return both the result of a parse and the portion of the input that
--   the argument parser consumed.
match :: ConsumedInputParsing m => m a -> m (ParserInput m, a)

-- | Wrapper that signifies lazy ByteString inputs
newtype Lazy (f :: Type -> Type) a
Lazy :: f a -> Lazy (f :: Type -> Type) a
[getLazy] :: Lazy (f :: Type -> Type) a -> f a

-- | Wrapper that signifies strict ByteString inputs
newtype Strict (f :: Type -> Type) a
Strict :: f a -> Strict (f :: Type -> Type) a
[getStrict] :: Strict (f :: Type -> Type) a -> f a
instance (GHC.Internal.Base.Monad m, Text.Parser.Input.ConsumedInputParsing m) => Text.Parser.Input.ConsumedInputParsing (Control.Monad.Trans.Identity.IdentityT m)
instance Text.Parser.Input.ConsumedInputParsing (Text.Parser.Wrapper.Lazy Data.Binary.Get.Internal.Get)
instance Text.Parser.Input.ConsumedInputParsing Data.Attoparsec.ByteString.Internal.Parser
instance Text.Parser.Input.ConsumedInputParsing Data.Attoparsec.Text.Internal.Parser
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.ConsumedInputParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.ConsumedInputParsing (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.ConsumedInputParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.ConsumedInputParsing (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance Text.Parser.Input.ConsumedInputParsing GHC.Internal.Text.ParserCombinators.ReadP.ReadP
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.ConsumedInputParsing m) => Text.Parser.Input.ConsumedInputParsing (Control.Monad.Trans.Reader.ReaderT e m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.ConsumedInputParsing m) => Text.Parser.Input.ConsumedInputParsing (Control.Monad.Trans.State.Strict.StateT s m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.ConsumedInputParsing m) => Text.Parser.Input.ConsumedInputParsing (Control.Monad.Trans.State.Lazy.StateT s m)
instance Text.Parser.Input.ConsumedInputParsing (Text.Parser.Wrapper.Strict Data.Binary.Get.Internal.Get)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.ConsumedInputParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.ConsumedInputParsing (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.ConsumedInputParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.ConsumedInputParsing (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputCharParsing m) => Text.Parser.Input.InputCharParsing (Control.Monad.Trans.Identity.IdentityT m)
instance (Data.Monoid.Textual.TextualMonoid s, GHC.Internal.Show.Show s, Text.Parsec.Prim.Stream s m GHC.Types.Char) => Text.Parser.Input.InputCharParsing (Text.Parsec.Prim.ParsecT s u m)
instance Text.Parser.Input.InputCharParsing Data.Attoparsec.ByteString.Internal.Parser
instance Text.Parser.Input.InputCharParsing Data.Attoparsec.Text.Internal.Parser
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputCharParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.InputCharParsing (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputCharParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.InputCharParsing (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance Text.Parser.Input.InputCharParsing GHC.Internal.Text.ParserCombinators.ReadP.ReadP
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputCharParsing m) => Text.Parser.Input.InputCharParsing (Control.Monad.Trans.Reader.ReaderT e m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputCharParsing m) => Text.Parser.Input.InputCharParsing (Control.Monad.Trans.State.Strict.StateT s m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputCharParsing m) => Text.Parser.Input.InputCharParsing (Control.Monad.Trans.State.Lazy.StateT s m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputCharParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.InputCharParsing (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputCharParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.InputCharParsing (Control.Monad.Trans.Writer.Lazy.WriterT w m)
instance (GHC.Internal.Base.Monad m, Text.Parser.Input.InputParsing m) => Text.Parser.Input.InputParsing (Control.Monad.Trans.Identity.IdentityT m)
instance Text.Parser.Input.InputParsing (Text.Parser.Wrapper.Lazy Data.Binary.Get.Internal.Get)
instance (Data.Monoid.Factorial.FactorialMonoid s, Data.Semigroup.Cancellative.LeftReductive s, GHC.Internal.Show.Show s, Text.Parsec.Prim.Stream s m t, GHC.Internal.Show.Show t) => Text.Parser.Input.InputParsing (Text.Parsec.Prim.ParsecT s u m)
instance Text.Parser.Input.InputParsing Data.Attoparsec.ByteString.Internal.Parser
instance Text.Parser.Input.InputParsing Data.Attoparsec.Text.Internal.Parser
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.InputParsing (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.InputParsing (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance Text.Parser.Input.InputParsing GHC.Internal.Text.ParserCombinators.ReadP.ReadP
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputParsing m) => Text.Parser.Input.InputParsing (Control.Monad.Trans.Reader.ReaderT e m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputParsing m) => Text.Parser.Input.InputParsing (Control.Monad.Trans.State.Strict.StateT s m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputParsing m) => Text.Parser.Input.InputParsing (Control.Monad.Trans.State.Lazy.StateT s m)
instance Text.Parser.Input.InputParsing (Text.Parser.Wrapper.Strict Data.Binary.Get.Internal.Get)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.InputParsing (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Input.InputParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Input.InputParsing (Control.Monad.Trans.Writer.Lazy.WriterT w m)

-- | Deterministic parsers can be restricted to succeed with a single
--   parsing result.
module Text.Parser.Deterministic

-- | Combinator methods for constructing deterministic parsers,
--   i.e., parsers that can succeed with only a single result.
class Parsing m => DeterministicParsing (m :: Type -> Type)

-- | Left-biased choice: if the left alternative succeeds, the right one is
--   never tried.
(<<|>) :: DeterministicParsing m => m a -> m a -> m a

-- | Like optional, but never succeeds with Nothing if the
--   argument parser can succeed.
takeOptional :: DeterministicParsing m => m a -> m (Maybe a)

-- | Like many, but always consuming the longest matching sequence
--   of input.
takeMany :: DeterministicParsing m => m a -> m [a]

-- | Like some, but always consuming the longest matching sequence
--   of input.
takeSome :: DeterministicParsing m => m a -> m [a]

-- | Like concatMany, but always consuming the longest matching
--   sequence of input.
concatAll :: (DeterministicParsing m, Monoid a) => m a -> m a

-- | Like skipMany, but always consuming the longest matching
--   sequence of input.
skipAll :: DeterministicParsing m => m a -> m ()
infixl 3 <<|>
instance (GHC.Internal.Base.Monad m, Text.Parser.Deterministic.DeterministicParsing m) => Text.Parser.Deterministic.DeterministicParsing (Control.Monad.Trans.Identity.IdentityT m)
instance Text.Parser.Deterministic.DeterministicParsing (Text.Parser.Wrapper.Lazy Data.Binary.Get.Internal.Get)
instance Text.Parser.Deterministic.DeterministicParsing Data.Attoparsec.ByteString.Internal.Parser
instance Text.Parser.Deterministic.DeterministicParsing Data.Attoparsec.Text.Internal.Parser
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Deterministic.DeterministicParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Deterministic.DeterministicParsing (Control.Monad.Trans.RWS.Strict.RWST r w s m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Deterministic.DeterministicParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Deterministic.DeterministicParsing (Control.Monad.Trans.RWS.Lazy.RWST r w s m)
instance Text.Parser.Deterministic.DeterministicParsing GHC.Internal.Text.ParserCombinators.ReadP.ReadP
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Deterministic.DeterministicParsing m) => Text.Parser.Deterministic.DeterministicParsing (Control.Monad.Trans.Reader.ReaderT e m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Deterministic.DeterministicParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Deterministic.DeterministicParsing (Control.Monad.Trans.State.Strict.StateT w m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Deterministic.DeterministicParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Deterministic.DeterministicParsing (Control.Monad.Trans.State.Lazy.StateT w m)
instance Text.Parser.Deterministic.DeterministicParsing (Text.Parser.Wrapper.Strict Data.Binary.Get.Internal.Get)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Deterministic.DeterministicParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Deterministic.DeterministicParsing (Control.Monad.Trans.Writer.Strict.WriterT w m)
instance (GHC.Internal.Base.MonadPlus m, Text.Parser.Deterministic.DeterministicParsing m, GHC.Internal.Base.Monoid w) => Text.Parser.Deterministic.DeterministicParsing (Control.Monad.Trans.Writer.Lazy.WriterT w m)
