-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Strict ByteString Parser Combinator -- -- Simple parser combinator for strict ByteString values. @package snack @version 0.3.0.0 -- | This module provides a parser for unicode Text. -- --
-- parseOnly (pContacts <* endOfInput) bstr --parseOnly :: Parser a -> Text -> Maybe a -- | Accepts a single, matching character. char :: Char -> Parser Char -- | Accepts a single, differing character. notChar :: Char -> Parser Char -- | Accepts a single character. anyChar :: Parser Char -- | Accepts a single character matching the predicate. satisfy :: (Char -> Bool) -> Parser Char -- | Accepts a single unicode white space character. See isSpace for -- details. space :: Parser Char -- | Returns True for any Unicode space character, and the control -- characters \t, \n, \r, \f, -- \v. isSpace :: Char -> Bool -- | Accepts multiple unicode white space characters. See isSpace -- for details. skipSpace :: Parser () -- | Peeks ahead, but does not consume. -- -- Be careful, peeking behind end of the input fails. You might want to -- check using atEnd beforehand. peekChar :: Parser Char -- | Accepts a matching string. string :: Text -> Parser Text -- | Same as string, but case insensitive. stringCI :: Text -> Parser Text -- | Accepts given number of characters. Fails when not enough characters -- are available. take :: Int -> Parser Text -- | Scans ahead statefully and then accepts whatever characters the -- scanner liked. Scanner returns Nothing to mark end of the -- acceptable extent. scan :: s -> (s -> Char -> Maybe s) -> Parser Text -- | Like scan, but also returns the final scanner state. runScanner :: s -> (s -> Char -> Maybe s) -> Parser (Text, s) -- | Efficiently consume as long as the input characters match the -- predicate. An inverse of takeTill. takeWhile :: (Char -> Bool) -> Parser Text -- | Like takeWhile, but requires at least a single character. takeWhile1 :: (Char -> Bool) -> Parser Text -- | Efficiently consume until a character matching the predicate is found. -- An inverse of takeWhile. takeTill :: (Char -> Bool) -> Parser Text -- | Same as takeTill, but requires at least a single character. takeTill1 :: (Char -> Bool) -> Parser Text -- | Accepts optional '+' or '-' character and then -- applies it to the following parser result. signed :: Num a => Parser a -> Parser a -- | Accepts an integral number in the decimal format. decimal :: Integral a => Parser a -- | Accepts an integral number in the hexadecimal format in either case. -- Does not look for 0x or similar prefixes. hexadecimal :: Integral a => Parser a -- | Accepts an integral number in the octal format. octal :: Integral a => Parser a -- | Accepts a fractional number as a decimal optinally followed by a colon -- and the fractional part. Does not support exponentiation. fractional :: Fractional a => Parser a -- | Fails if the value returned by the parser does not conform to the -- predicate. Generalized form of string. -- -- Example: -- --
-- pInput = takeWhile isLetter `provided` (odd . length) --provided :: (Alternative m, Monad m) => m a -> (a -> Bool) -> m a -- | Tries various parsers, one by one. -- -- Example: -- --
-- pExpression = choice [ pConstant -- , pVariable -- , pBinaryOperation -- , pFunctionApplication -- ] --choice :: Alternative f => [f a] -> f a -- | Replicates the parser given number of times, collecting the results in -- a list. Fails if any instance of the parser fails. -- -- Example: -- --
-- pFourWords = (:) <$> word <*> count 3 (blank *> word) -- where word = takeWhile1 isLetter -- blank = takeWhile1 isSpace --count :: Monad m => Int -> m a -> m [a] -- | One or none. optional :: Alternative f => f a -> f (Maybe a) -- | Captures first parser as Left or the second as -- Right. eitherP :: Alternative f => f a -> f b -> f (Either a b) -- | Shortcut for optional with a default value. -- -- Example: -- --
-- data Contact =
-- Contact
-- { contactName :: Text
-- , contactEmail :: Maybe Text
-- }
--
-- pContact = Contact <$> pFullName <*> option pEmail
--
option :: Alternative f => a -> f a -> f a
-- | Zero or more.
many :: Alternative f => f a -> f [a]
-- | Like many1, but requires at least one match.
many1 :: Alternative f => f a -> f [a]
-- | Like many, but stops once the second parser matches the input
-- ahead.
--
-- Example:
--
-- -- pBodyLines = pLine `manyTill` pEnd -- where pLine = takeTill (== 'n') -- pEnd = string "n.n" --manyTill :: Alternative f => f a -> f a -> f [a] -- | Similar to many, but interleaves the first parser with the -- second. -- -- Example: -- --
-- pLines = pLine sepBy char 'n' --sepBy :: Alternative f => f a -> f b -> f [a] -- | Like sepBy, but requires at least one match. sepBy1 :: Alternative f => f a -> f b -> f [a] -- | Wraps the parser from both sides. -- -- Example: -- --
-- pToken = takeWhile1 (inClass "A-Za-z0-9_") `wrap` takeWhile isSpace --wrap :: Applicative f => f a -> f b -> f a -- | Makes the parser not only return the result, but also the original -- matched extent. match :: Parser a -> Parser (Text, a) -- | Names an extent of the parser. -- -- When the extent returns a Failure, details are discarded and replaced -- with the extent as a whole. -- -- When the extent returns an Error, it is adjusted to cover the whole -- extent, but the reason is left intact. -- -- You should strive to make labeled extents as small as possible, -- approximately of a typical token size. For example: -- --
-- pString = label "string" $ pStringContents `wrap` char '"' --label :: String -> Parser a -> Parser a -- | Un-names an extent of the parser. -- -- Same as label, but removes any expected values upon Failure. -- Very useful to mark comments and optional whitespace with. unlabel :: Parser a -> Parser a -- | Disable backtracking for the parser. Failure is treated as an Error. commit :: Parser a -> Parser a -- | Validate parser result and turn it into an Error upon failure. validate :: (a -> Either String b) -> Parser a -> Parser b -- | Accept whatever input remains. takeText :: Parser Text -- | Peek at whatever input remains. peekText :: Parser Text -- | Accepts end of input and fails if we are not there yet. endOfInput :: Parser () -- | Returns whether we are at the end of the input yet. atEnd :: Parser Bool -- | Calculate offset from the original input and the remainder. offset :: Text -> Text -> Int -- | Determine (line, column) from the original input and the -- remainder. -- -- Counts line feed characters leading to the offset, so only use -- it on your slow path. For example when describing parsing errors. position :: Text -> Text -> (Int, Int) -- | Process the result for showing it to the user. explain :: String -> Text -> Result a -> Explanation -- | More precise Result description produced by explain. data Explanation Explanation :: String -> (Int, Int) -> (Int, Int) -> String -> Explanation -- | Name of the source file. [exSource] :: Explanation -> String -- | Line and column where the problem starts. [exSpanFrom] :: Explanation -> (Int, Int) -- | Line and column where the problem ends. [exSpanTo] :: Explanation -> (Int, Int) -- | Message associated with the problem. [exMessage] :: Explanation -> String -- | The identity of <|> empty :: Alternative f => f a -- | Lift a value. pure :: Applicative f => a -> f a -- | Conditional failure of Alternative computations. Defined by -- --
-- guard True = pure () -- guard False = empty ---- --
-- >>> safeDiv 4 0 -- Nothing -- >>> safeDiv 4 2 -- Just 2 ---- -- A definition of safeDiv using guards, but not guard: -- --
-- safeDiv :: Int -> Int -> Maybe Int -- safeDiv x y | y /= 0 = Just (x `div` y) -- | otherwise = Nothing ---- -- A definition of safeDiv using guard and Monad -- do-notation: -- --
-- safeDiv :: Int -> Int -> Maybe Int -- safeDiv x y = do -- guard (y /= 0) -- return (x `div` y) --guard :: Alternative f => Bool -> f () -- | Conditional execution of Applicative expressions. For example, -- --
-- when debug (putStrLn "Debugging") ---- -- will output the string Debugging if the Boolean value -- debug is True, and otherwise do nothing. when :: Applicative f => Bool -> f () -> f () -- | The reverse of when. unless :: Applicative f => Bool -> f () -> f () -- | void value discards or ignores the result of -- evaluation, such as the return value of an IO action. -- -- Using ApplicativeDo: 'void as' can be -- understood as the do expression -- --
-- do as -- pure () ---- -- with an inferred Functor constraint. -- --
-- >>> void Nothing -- Nothing -- -- >>> void (Just 3) -- Just () ---- -- Replace the contents of an Either Int -- Int with unit, resulting in an Either -- Int (): -- --
-- >>> void (Left 8675309) -- Left 8675309 -- -- >>> void (Right 8675309) -- Right () ---- -- Replace every element of a list with unit: -- --
-- >>> void [1,2,3] -- [(),(),()] ---- -- Replace the second element of a pair with unit: -- --
-- >>> void (1,2) -- (1,()) ---- -- Discard the result of an IO action: -- --
-- >>> mapM print [1,2] -- 1 -- 2 -- [(),()] -- -- >>> void $ mapM print [1,2] -- 1 -- 2 --void :: Functor f => f a -> f () instance GHC.Show.Show a => GHC.Show.Show (Data.Text.Parser.Result a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Text.Parser.Result a) instance GHC.Show.Show Data.Text.Parser.Explanation instance GHC.Classes.Eq Data.Text.Parser.Explanation instance GHC.Base.Functor Data.Text.Parser.Parser instance GHC.Base.Applicative Data.Text.Parser.Parser instance GHC.Base.Alternative Data.Text.Parser.Parser instance GHC.Base.Monad Data.Text.Parser.Parser instance GHC.Base.MonadPlus Data.Text.Parser.Parser instance GHC.Base.Functor Data.Text.Parser.Result -- | This module provides a parser for ByteString. -- --
-- parseOnly (pContacts <* endOfInput) bstr --parseOnly :: Parser a -> ByteString -> Maybe a -- | Accepts a single, matching byte. byte :: Word8 -> Parser Word8 -- | Accepts a single, differing byte. notByte :: Word8 -> Parser Word8 -- | Accepts a single byte. anyByte :: Parser Word8 -- | Accepts a single byte matching the predicate. satisfy :: (Word8 -> Bool) -> Parser Word8 -- | Peeks ahead, but does not consume. -- -- Be careful, peeking behind end of the input fails. You might want to -- check using atEnd beforehand. peekByte :: Parser Word8 -- | Accepts a matching string. string :: ByteString -> Parser ByteString -- | Accepts given number of bytes. Fails when not enough bytes are -- available. take :: Int -> Parser ByteString -- | Scans ahead statefully and then accepts whatever bytes the scanner -- liked. Scanner returns Nothing to mark end of the acceptable -- extent. scan :: s -> (s -> Word8 -> Maybe s) -> Parser ByteString -- | Like scan, but also returns the final scanner state. runScanner :: s -> (s -> Word8 -> Maybe s) -> Parser (ByteString, s) -- | Efficiently consume as long as the input bytes match the predicate. An -- inverse of takeTill. takeWhile :: (Word8 -> Bool) -> Parser ByteString -- | Like takeWhile, but requires at least a single byte. takeWhile1 :: (Word8 -> Bool) -> Parser ByteString -- | Efficiently consume until a byte matching the predicate is found. An -- inverse of takeWhile. takeTill :: (Word8 -> Bool) -> Parser ByteString -- | Same as takeTill, but requires at least a single byte. takeTill1 :: (Word8 -> Bool) -> Parser ByteString -- | Fails if the value returned by the parser does not conform to the -- predicate. Generalized form of string. -- -- Example: -- --
-- pInput = takeWhile isLetter `provided` (odd . length) --provided :: (Alternative m, Monad m) => m a -> (a -> Bool) -> m a -- | Tries various parsers, one by one. -- -- Example: -- --
-- pExpression = choice [ pConstant -- , pVariable -- , pBinaryOperation -- , pFunctionApplication -- ] --choice :: Alternative f => [f a] -> f a -- | Replicates the parser given number of times, collecting the results in -- a list. Fails if any instance of the parser fails. -- -- Example: -- --
-- pFourWords = (:) <$> word <*> count 3 (blank *> word) -- where word = takeWhile1 isLetter -- blank = takeWhile1 isSpace --count :: Monad m => Int -> m a -> m [a] -- | One or none. optional :: Alternative f => f a -> f (Maybe a) -- | Captures first parser as Left or the second as -- Right. eitherP :: Alternative f => f a -> f b -> f (Either a b) -- | Shortcut for optional with a default value. -- -- Example: -- --
-- data Contact =
-- Contact
-- { contactName :: Text
-- , contactEmail :: Maybe Text
-- }
--
-- pContact = Contact <$> pFullName <*> option pEmail
--
option :: Alternative f => a -> f a -> f a
-- | Zero or more.
many :: Alternative f => f a -> f [a]
-- | Like many1, but requires at least one match.
many1 :: Alternative f => f a -> f [a]
-- | Like many, but stops once the second parser matches the input
-- ahead.
--
-- Example:
--
-- -- pBodyLines = pLine `manyTill` pEnd -- where pLine = takeTill (== 'n') -- pEnd = string "n.n" --manyTill :: Alternative f => f a -> f a -> f [a] -- | Similar to many, but interleaves the first parser with the -- second. -- -- Example: -- --
-- pLines = pLine sepBy char 'n' --sepBy :: Alternative f => f a -> f b -> f [a] -- | Like sepBy, but requires at least one match. sepBy1 :: Alternative f => f a -> f b -> f [a] -- | Wraps the parser from both sides. -- -- Example: -- --
-- pToken = takeWhile1 (inClass "A-Za-z0-9_") `wrap` takeWhile isSpace --wrap :: Applicative f => f a -> f b -> f a -- | Makes the parser not only return the result, but also the original -- matched extent. match :: Parser a -> Parser (ByteString, a) -- | Names an extent of the parser. -- -- When the extent returns a Failure, details are discarded and replaced -- with the extent as a whole. -- -- When the extent returns an Error, it is adjusted to cover the whole -- extent, but the reason is left intact. -- -- You should strive to make labeled extents as small as possible, -- approximately of a typical token size. For example: -- --
-- pString = label "string" $ pStringContents `wrap` char '"' --label :: String -> Parser a -> Parser a -- | Un-names an extent of the parser. -- -- Same as label, but removes any expected values upon Failure. -- Very useful to mark comments and optional whitespace with. unlabel :: Parser a -> Parser a -- | Disable backtracking for the parser. Failure is treated as an Error. commit :: Parser a -> Parser a -- | Validate parser result and turn it into an Error upon failure. validate :: (a -> Either String b) -> Parser a -> Parser b -- | Accept whatever input remains. takeByteString :: Parser ByteString -- | Peek at whatever input remains. peekByteString :: Parser ByteString -- | Accepts end of input and fails if we are not there yet. endOfInput :: Parser () -- | Returns whether we are at the end of the input yet. atEnd :: Parser Bool -- | Calculate offset from the original input and the remainder. offset :: ByteString -> ByteString -> Int -- | The identity of <|> empty :: Alternative f => f a -- | Lift a value. pure :: Applicative f => a -> f a -- | Conditional failure of Alternative computations. Defined by -- --
-- guard True = pure () -- guard False = empty ---- --
-- >>> safeDiv 4 0 -- Nothing -- >>> safeDiv 4 2 -- Just 2 ---- -- A definition of safeDiv using guards, but not guard: -- --
-- safeDiv :: Int -> Int -> Maybe Int -- safeDiv x y | y /= 0 = Just (x `div` y) -- | otherwise = Nothing ---- -- A definition of safeDiv using guard and Monad -- do-notation: -- --
-- safeDiv :: Int -> Int -> Maybe Int -- safeDiv x y = do -- guard (y /= 0) -- return (x `div` y) --guard :: Alternative f => Bool -> f () -- | Conditional execution of Applicative expressions. For example, -- --
-- when debug (putStrLn "Debugging") ---- -- will output the string Debugging if the Boolean value -- debug is True, and otherwise do nothing. when :: Applicative f => Bool -> f () -> f () -- | The reverse of when. unless :: Applicative f => Bool -> f () -> f () -- | void value discards or ignores the result of -- evaluation, such as the return value of an IO action. -- -- Using ApplicativeDo: 'void as' can be -- understood as the do expression -- --
-- do as -- pure () ---- -- with an inferred Functor constraint. -- --
-- >>> void Nothing -- Nothing -- -- >>> void (Just 3) -- Just () ---- -- Replace the contents of an Either Int -- Int with unit, resulting in an Either -- Int (): -- --
-- >>> void (Left 8675309) -- Left 8675309 -- -- >>> void (Right 8675309) -- Right () ---- -- Replace every element of a list with unit: -- --
-- >>> void [1,2,3] -- [(),(),()] ---- -- Replace the second element of a pair with unit: -- --
-- >>> void (1,2) -- (1,()) ---- -- Discard the result of an IO action: -- --
-- >>> mapM print [1,2] -- 1 -- 2 -- [(),()] -- -- >>> void $ mapM print [1,2] -- 1 -- 2 --void :: Functor f => f a -> f () instance GHC.Show.Show a => GHC.Show.Show (Data.ByteString.Parser.Result a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.ByteString.Parser.Result a) instance GHC.Base.Functor Data.ByteString.Parser.Parser instance GHC.Base.Applicative Data.ByteString.Parser.Parser instance GHC.Base.Alternative Data.ByteString.Parser.Parser instance GHC.Base.Monad Data.ByteString.Parser.Parser instance GHC.Base.MonadPlus Data.ByteString.Parser.Parser instance Control.Monad.Fail.MonadFail Data.ByteString.Parser.Parser instance GHC.Base.Functor Data.ByteString.Parser.Result -- | This module provides a parser for ASCII ByteString. -- --
-- parseOnly (pContacts <* endOfInput) bstr --parseOnly :: Parser a -> ByteString -> Maybe a -- | Accepts a single, matching ASCII character. char :: Char -> Parser Char -- | Accepts a single, differing ASCII character. notChar :: Char -> Parser Char -- | Accepts a single character. anyChar :: Parser Char -- | Accepts a single character matching the predicate. satisfy :: (Char -> Bool) -> Parser Char -- | Accepts a single ASCII white space character. See isSpace for -- details. space :: Parser Char -- | True for any of the [' ', '\t', '\n', '\v', '\f', '\r'] -- characters. -- -- Please note that Data.Text.Parser re-exports isString, -- that considers more unicode codepoints, making it significantly -- slower. isSpace :: Char -> Bool -- | Accepts multiple ASCII white space characters. See isSpace for -- details. skipSpace :: Parser () -- | Peeks ahead, but does not consume. -- -- Be careful, peeking behind end of the input fails. You might want to -- check using atEnd beforehand. peekChar :: Parser Char -- | Accepts a matching string. string :: ByteString -> Parser ByteString -- | Accepts a matching string. Matching is performed in a case-insensitive -- manner under ASCII. stringCI :: ByteString -> Parser ByteString -- | Accepts given number of bytes. Fails when not enough bytes are -- available. take :: Int -> Parser ByteString -- | Scans ahead statefully and then accepts whatever bytes the scanner -- liked. Scanner returns Nothing to mark end of the acceptable -- extent. scan :: s -> (s -> Char -> Maybe s) -> Parser ByteString -- | Like scan, but also returns the final scanner state. runScanner :: s -> (s -> Char -> Maybe s) -> Parser (ByteString, s) -- | Tests whether the character lies within given range. -- -- Definition: -- --
-- inRange lo hi = c -> (lo <= c && c <= hi) --inRange :: Char -> Char -> Char -> Bool -- | Negation of inRange. -- -- Definition: -- --
-- notInRange lo hi = c -> (c <= lo || hi <= c) --notInRange :: Char -> Char -> Char -> Bool -- | Efficiently consume as long as the input characters match the -- predicate. An inverse of takeTill. takeWhile :: (Char -> Bool) -> Parser ByteString -- | Like takeWhile, but requires at least a single character. takeWhile1 :: (Char -> Bool) -> Parser ByteString -- | Efficiently consume until a character matching the predicate is found. -- An inverse of takeWhile. takeTill :: (Char -> Bool) -> Parser ByteString -- | Same as takeTill, but requires at least a single character. takeTill1 :: (Char -> Bool) -> Parser ByteString -- | Accepts optional '+' or '-' character and then -- applies it to the following parser result. signed :: Num a => Parser a -> Parser a -- | Accepts an integral number in the decimal format. decimal :: Integral a => Parser a -- | Accepts an integral number in the hexadecimal format in either case. -- Does not look for 0x or similar prefixes. hexadecimal :: Integral a => Parser a -- | Accepts an integral number in the octal format. octal :: Integral a => Parser a -- | Accepts a fractional number as a decimal optinally followed by a colon -- and the fractional part. Does not support exponentiation. fractional :: Fractional a => Parser a -- | Fails if the value returned by the parser does not conform to the -- predicate. Generalized form of string. -- -- Example: -- --
-- pInput = takeWhile isLetter `provided` (odd . length) --provided :: (Alternative m, Monad m) => m a -> (a -> Bool) -> m a -- | Tries various parsers, one by one. -- -- Example: -- --
-- pExpression = choice [ pConstant -- , pVariable -- , pBinaryOperation -- , pFunctionApplication -- ] --choice :: Alternative f => [f a] -> f a -- | Replicates the parser given number of times, collecting the results in -- a list. Fails if any instance of the parser fails. -- -- Example: -- --
-- pFourWords = (:) <$> word <*> count 3 (blank *> word) -- where word = takeWhile1 isLetter -- blank = takeWhile1 isSpace --count :: Monad m => Int -> m a -> m [a] -- | One or none. optional :: Alternative f => f a -> f (Maybe a) -- | Captures first parser as Left or the second as -- Right. eitherP :: Alternative f => f a -> f b -> f (Either a b) -- | Shortcut for optional with a default value. -- -- Example: -- --
-- data Contact =
-- Contact
-- { contactName :: Text
-- , contactEmail :: Maybe Text
-- }
--
-- pContact = Contact <$> pFullName <*> option pEmail
--
option :: Alternative f => a -> f a -> f a
-- | Zero or more.
many :: Alternative f => f a -> f [a]
-- | Like many1, but requires at least one match.
many1 :: Alternative f => f a -> f [a]
-- | Like many, but stops once the second parser matches the input
-- ahead.
--
-- Example:
--
-- -- pBodyLines = pLine `manyTill` pEnd -- where pLine = takeTill (== 'n') -- pEnd = string "n.n" --manyTill :: Alternative f => f a -> f a -> f [a] -- | Similar to many, but interleaves the first parser with the -- second. -- -- Example: -- --
-- pLines = pLine sepBy char 'n' --sepBy :: Alternative f => f a -> f b -> f [a] -- | Like sepBy, but requires at least one match. sepBy1 :: Alternative f => f a -> f b -> f [a] -- | Wraps the parser from both sides. -- -- Example: -- --
-- pToken = takeWhile1 (inClass "A-Za-z0-9_") `wrap` takeWhile isSpace --wrap :: Applicative f => f a -> f b -> f a -- | Makes the parser not only return the result, but also the original -- matched extent. match :: Parser a -> Parser (ByteString, a) -- | Names an extent of the parser. -- -- When the extent returns a Failure, details are discarded and replaced -- with the extent as a whole. -- -- When the extent returns an Error, it is adjusted to cover the whole -- extent, but the reason is left intact. -- -- You should strive to make labeled extents as small as possible, -- approximately of a typical token size. For example: -- --
-- pString = label "string" $ pStringContents `wrap` char '"' --label :: String -> Parser a -> Parser a -- | Un-names an extent of the parser. -- -- Same as label, but removes any expected values upon Failure. -- Very useful to mark comments and optional whitespace with. unlabel :: Parser a -> Parser a -- | Disable backtracking for the parser. Failure is treated as an Error. commit :: Parser a -> Parser a -- | Validate parser result and turn it into an Error upon failure. validate :: (a -> Either String b) -> Parser a -> Parser b -- | Accept whatever input remains. takeByteString :: Parser ByteString -- | Peek at whatever input remains. peekByteString :: Parser ByteString -- | Accepts end of input and fails if we are not there yet. endOfInput :: Parser () -- | Returns whether we are at the end of the input yet. atEnd :: Parser Bool -- | Calculate offset from the original input and the remainder. offset :: ByteString -> ByteString -> Int -- | Determine (line, column) from the original input and the -- remainder. -- -- Counts line feed characters leading to the offset, so only use -- it on your slow path. For example when describing parsing errors. position :: ByteString -> ByteString -> (Int, Int) -- | Process the result for showing it to the user. explain :: String -> ByteString -> Result a -> Explanation -- | More precise Result description produced by explain. data Explanation Explanation :: String -> (Int, Int) -> (Int, Int) -> String -> Explanation -- | Name of the source file. [exSource] :: Explanation -> String -- | Line and column where the problem starts. [exSpanFrom] :: Explanation -> (Int, Int) -- | Line and column where the problem ends. [exSpanTo] :: Explanation -> (Int, Int) -- | Message associated with the problem. [exMessage] :: Explanation -> String -- | The identity of <|> empty :: Alternative f => f a -- | Lift a value. pure :: Applicative f => a -> f a -- | Conditional failure of Alternative computations. Defined by -- --
-- guard True = pure () -- guard False = empty ---- --
-- >>> safeDiv 4 0 -- Nothing -- >>> safeDiv 4 2 -- Just 2 ---- -- A definition of safeDiv using guards, but not guard: -- --
-- safeDiv :: Int -> Int -> Maybe Int -- safeDiv x y | y /= 0 = Just (x `div` y) -- | otherwise = Nothing ---- -- A definition of safeDiv using guard and Monad -- do-notation: -- --
-- safeDiv :: Int -> Int -> Maybe Int -- safeDiv x y = do -- guard (y /= 0) -- return (x `div` y) --guard :: Alternative f => Bool -> f () -- | Conditional execution of Applicative expressions. For example, -- --
-- when debug (putStrLn "Debugging") ---- -- will output the string Debugging if the Boolean value -- debug is True, and otherwise do nothing. when :: Applicative f => Bool -> f () -> f () -- | The reverse of when. unless :: Applicative f => Bool -> f () -> f () -- | void value discards or ignores the result of -- evaluation, such as the return value of an IO action. -- -- Using ApplicativeDo: 'void as' can be -- understood as the do expression -- --
-- do as -- pure () ---- -- with an inferred Functor constraint. -- --
-- >>> void Nothing -- Nothing -- -- >>> void (Just 3) -- Just () ---- -- Replace the contents of an Either Int -- Int with unit, resulting in an Either -- Int (): -- --
-- >>> void (Left 8675309) -- Left 8675309 -- -- >>> void (Right 8675309) -- Right () ---- -- Replace every element of a list with unit: -- --
-- >>> void [1,2,3] -- [(),(),()] ---- -- Replace the second element of a pair with unit: -- --
-- >>> void (1,2) -- (1,()) ---- -- Discard the result of an IO action: -- --
-- >>> mapM print [1,2] -- 1 -- 2 -- [(),()] -- -- >>> void $ mapM print [1,2] -- 1 -- 2 --void :: Functor f => f a -> f () instance GHC.Show.Show Data.ByteString.Parser.Char8.Explanation instance GHC.Classes.Eq Data.ByteString.Parser.Char8.Explanation