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


-- | Parses frontmatter as used in Jekyll markdown files.
--   
--   Parses frontmatter as used in Jekyll markdown files.
--   
--   Provides a parser that'll parse the frontmatter only and one that'll
--   execute a YAML parser on it, so that it's a YAML frontmatter parser.
@package frontmatter
@version 0.1.0.2

module Data.Frontmatter.Internal

-- | A parser for a frontmatter; returns it as a <a>ByteString</a>. Doesn't
--   fail even if it's empty. When it fails; returns a a IResult with the
--   whole input rather than consuming it.
frontmatter :: Parser ByteString

-- | Internal parser for the frontmatter separator
frontmatterSeparator :: Parser ()

module Data.Yaml.Frontmatter

-- | Parses a YAML frontmatter or JSON frontmatter from a
--   <tt>ByteString</tt> as a <a>Value</a>. Because of how
--   <tt>Data.Yaml</tt> is implemented using <tt>aeson</tt>, this will
--   succeed for JSON frontmatters as well as YAML ones.
frontmatterYaml :: FromJSON a => Parser a

module Data.Frontmatter

-- | A parser for a frontmatter; returns it as a <a>ByteString</a>. Doesn't
--   fail even if it's empty. When it fails; returns a a IResult with the
--   whole input rather than consuming it.
frontmatter :: Parser ByteString

-- | Parses a YAML frontmatter or JSON frontmatter from a
--   <tt>ByteString</tt> as a <a>Value</a>. Because of how
--   <tt>Data.Yaml</tt> is implemented using <tt>aeson</tt>, this will
--   succeed for JSON frontmatters as well as YAML ones.
frontmatterYaml :: FromJSON a => Parser a

-- | Parse a frontmatter from a <a>ByteString</a> returning a
--   <a>Result</a>. Just extracts whatever is on the frontmatter; doesn't
--   care what it is.
parseFrontmatter :: ByteString -> Result ByteString

-- | <a>parseFrontmatter</a> but returning a <a>Maybe</a>
parseFrontmatterMaybe :: ByteString -> Maybe ByteString

-- | <a>parseFrontmatter</a> but returning an <a>Either</a>
parseFrontmatterEither :: ByteString -> Either String ByteString

-- | Parse a frontmatter from a <a>ByteString</a> returning a 'FromJSON a'.
--   Will parse both JSON and YAML.
parseYamlFrontmatter :: FromJSON a => ByteString -> Result a

-- | <a>parseYamlFrontmatter</a> but returning a <a>Maybe</a>
parseYamlFrontmatterMaybe :: FromJSON a => ByteString -> Maybe a

-- | <a>parseYamlFrontmatter</a> but returning an <a>Either</a>
parseYamlFrontmatterEither :: FromJSON a => ByteString -> Either String a

-- | Run a parser.
parse :: Parser a -> ByteString -> Result a

-- | Convert a <a>Result</a> value to a <a>Maybe</a> value. A
--   <a>Partial</a> result is treated as failure.
maybeResult :: Result r -> Maybe r

-- | Convert a <a>Result</a> value to an <a>Either</a> value. A
--   <a>Partial</a> result is treated as failure.
eitherResult :: Result r -> Either String r
type Parser = Parser ByteString
type Result = IResult ByteString

-- | The result of a parse. This is parameterised over the type <tt>i</tt>
--   of string that was processed.
--   
--   This type is an instance of <a>Functor</a>, where <a>fmap</a>
--   transforms the value in a <a>Done</a> result.
data IResult i r :: * -> * -> *

-- | The parse failed. The <tt>i</tt> parameter is the input that had not
--   yet been consumed when the failure occurred. The
--   <tt>[</tt><a>String</a><tt>]</tt> is a list of contexts in which the
--   error occurred. The <a>String</a> is the message describing the error,
--   if any.
Fail :: i -> [String] -> String -> IResult i r

-- | Supply this continuation with more input so that the parser can
--   resume. To indicate that no more input is available, pass an empty
--   string to the continuation.
--   
--   <b>Note</b>: if you get a <a>Partial</a> result, do not call its
--   continuation more than once.
Partial :: (i -> IResult i r) -> IResult i r

-- | The parse succeeded. The <tt>i</tt> parameter is the input that had
--   not yet been consumed (if any) when the parse succeeded.
Done :: i -> r -> IResult i r
