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


-- | indentation sensitive parser-combinators for parsec
--   
--   This library provides functions for use in parsing indentation
--   sensitive contexts. It parses blocks of lines all indented to the same
--   level as well as lines continued at an indented level below.
@package indents
@version 0.4.0.0

module Text.Parsec.Indent

-- | Indentation transformer.
type IndentT m = ReaderT Pos m

-- | Indentation sensitive parser type. Usually <tt>m</tt> will be
--   <a>Identity</a> as with any <a>ParsecT</a>. In that case you can use
--   the simpler <a>IndentParser</a> type.
type IndentParserT s u m a = ParsecT s u (IndentT m) a

-- | A simplified <a>IndentParserT</a>.
type IndentParser s u a = IndentParserT s u Identity a

-- | Simplified version of <a>runIndentT</a>.
runIndent :: IndentT Identity a -> a

-- | This is a convenience function which wraps <a>runIndentT</a> and
--   <a>runParserT</a>.
runIndentParserT :: (Monad m, Stream s (IndentT m) t) => IndentParserT s u m a -> u -> SourceName -> s -> m (Either ParseError a)

-- | This is another convenience function. Use this instead of
--   <a>runIndentParserT</a> if <tt>m</tt> is <a>Identity</a>.
runIndentParser :: Stream s (IndentT Identity) t => IndentParser s u a -> u -> SourceName -> s -> Either ParseError a

-- | <tt> <a>withBlock</a> f a p </tt> parses <tt> a </tt> followed by an
--   indented block of <tt> p </tt> combining them with <tt> f </tt>
withBlock :: (Monad m, Stream s (IndentT m) z) => (a -> [b] -> c) -> IndentParserT s u m a -> IndentParserT s u m b -> IndentParserT s u m c

-- | Like <a>withBlock</a>, but throws away initial parse result
withBlock' :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m a -> IndentParserT s u m b -> IndentParserT s u m [b]

-- | Parses a block of lines at the same indentation level
block :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m a -> IndentParserT s u m [a]

-- | Parses only when indented past the level of the reference
indented :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m ()

-- | Parses only on the same line as the reference
same :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m ()

-- | Parses only when indented past the level of the reference or on the
--   same line
sameOrIndented :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m ()

-- | Ensures the current indentation level matches that of the reference
checkIndent :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m ()

-- | Ensures that there is no indentation.
topLevel :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m ()

-- | Ensures that there is at least some indentation.
notTopLevel :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m ()

-- | Parses using the current location for indentation reference
withPos :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m a -> IndentParserT s u m a

-- | parses with surrounding brackets
indentBrackets :: (Monad m, Stream s (IndentT m) z) => GenTokenParser s u (IndentT m) -> IndentParserT s u m a -> IndentParserT s u m a

-- | parses with surrounding angle brackets
indentAngles :: (Monad m, Stream s (IndentT m) z) => GenTokenParser s u (IndentT m) -> IndentParserT s u m a -> IndentParserT s u m a

-- | parses with surrounding braces
indentBraces :: (Monad m, Stream s (IndentT m) z) => GenTokenParser s u (IndentT m) -> IndentParserT s u m a -> IndentParserT s u m a

-- | parses with surrounding parentheses
indentParens :: (Monad m, Stream s (IndentT m) z) => GenTokenParser s u (IndentT m) -> IndentParserT s u m a -> IndentParserT s u m a

-- | <a>&lt;+/&gt;</a> is to indentation sensitive parsers what <a>ap</a>
--   is to monads
(<+/>) :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m (a -> b) -> IndentParserT s u m a -> IndentParserT s u m b

-- | <a>&lt;-/&gt;</a> is like <a>&lt;+/&gt;</a>, but doesn't apply the
--   function to the parsed value
(<-/>) :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m a -> IndentParserT s u m b -> IndentParserT s u m a

-- | Like <a>&lt;+/&gt;</a> but applies the second parser many times
(<*/>) :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m ([a] -> b) -> IndentParserT s u m a -> IndentParserT s u m b

-- | Like <a>&lt;+/&gt;</a> but applies the second parser optionally using
--   the <a>Optional</a> datatype
(<?/>) :: (Monad m, Stream s (IndentT m) z) => IndentParserT s u m (a -> b) -> (Optional s u m a) -> IndentParserT s u m b

-- | Datatype used to optional parsing
data Optional s u m a
Opt :: a -> (IndentParserT s u m a) -> Optional s u m a
instance GHC.Show.Show Text.Parsec.Indent.Pos
