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


-- | Utility functions for testing Megaparsec parsers with Hspec
--   
--   Utility functions for testing Megaparsec parsers with Hspec.
@package hspec-megaparsec
@version 2.2.0


-- | Utility functions for testing Megaparsec parsers with Hspec.
module Test.Hspec.Megaparsec

-- | Create an expectation by saying what the result should be.
--   
--   <pre>
--   parse letterChar "" "x" `shouldParse` 'x'
--   </pre>
shouldParse :: (HasCallStack, ShowErrorComponent e, Stream s, VisualStream s, TraversableStream s, Show a, Eq a) => Either (ParseErrorBundle s e) a -> a -> Expectation

-- | Create an expectation by saying that the parser should successfully
--   parse a value and that the value should satisfy some predicate.
--   
--   <pre>
--   parse (many punctuationChar) "" "?!!" `parseSatisfies` ((== 3) . length)
--   </pre>
parseSatisfies :: (HasCallStack, ShowErrorComponent e, Stream s, VisualStream s, TraversableStream s, Show a, Eq a) => Either (ParseErrorBundle s e) a -> (a -> Bool) -> Expectation

-- | Check that a parser succeeds on a given input.
--   
--   <pre>
--   parse (char 'x') "" `shouldSucceedOn` "x"
--   </pre>
shouldSucceedOn :: (HasCallStack, ShowErrorComponent e, Stream s, VisualStream s, TraversableStream s, Show a) => (s -> Either (ParseErrorBundle s e) a) -> s -> Expectation

-- | Check that a parser fails on a given input.
--   
--   <pre>
--   parse (char 'x') "" `shouldFailOn` "a"
--   </pre>
shouldFailOn :: (HasCallStack, Show a) => (s -> Either (ParseErrorBundle s e) a) -> s -> Expectation

-- | Create an expectation that parser should fail producing certain
--   <a>ParseError</a>. Use the <a>err</a> function from this module to
--   construct a <a>ParseError</a> to compare with.
--   
--   <pre>
--   parse (char 'x') "" "b" `shouldFailWith` err posI (utok 'b' &lt;&gt; etok 'x')
--   </pre>
shouldFailWith :: (HasCallStack, ShowErrorComponent e, Stream s, VisualStream s, TraversableStream s, Show a, Eq e) => Either (ParseErrorBundle s e) a -> ParseError s e -> Expectation

-- | Similar to <a>shouldFailWith</a>, but allows to check parsers that can
--   report more than one parse error at a time.
shouldFailWithM :: (HasCallStack, ShowErrorComponent e, Stream s, VisualStream s, TraversableStream s, Show a, Eq e) => Either (ParseErrorBundle s e) a -> [ParseError s e] -> Expectation

-- | Check that a parser fails and leaves a certain part of input
--   unconsumed. Use it with functions like <a>runParser'</a> and
--   <a>runParserT'</a> that support incremental parsing.
--   
--   <pre>
--   runParser' (many (char 'x') &lt;* eof) (initialState "xxa")
--     `failsLeaving` "a"
--   </pre>
--   
--   See also: <a>initialState</a>.
failsLeaving :: (HasCallStack, Show a, Eq s, Show s) => (State s e, Either (ParseErrorBundle s e) a) -> s -> Expectation

-- | Check that a parser succeeds and leaves certain part of input
--   unconsumed. Use it with functions like <a>runParser'</a> and
--   <a>runParserT'</a> that support incremental parsing.
--   
--   <pre>
--   runParser' (many (char 'x')) (initialState "xxa")
--     `succeedsLeaving` "a"
--   </pre>
--   
--   See also: <a>initialState</a>.
succeedsLeaving :: (HasCallStack, Show a, Eq s, Show s, ShowErrorComponent e, Stream s, VisualStream s, TraversableStream s) => (State s e, Either (ParseErrorBundle s e) a) -> s -> Expectation

-- | Given input for parsing, construct initial state for parser.
initialState :: s -> State s e

-- | Given input for parsing, construct initial positional state.
initialPosState :: s -> PosState s
