match

Return both the result of a parse and the portion of the input that was consumed while it was being parsed.
Return both the result of a parse and the portion of the input that was consumed while it was being parsed.
Decompose a Graph into the MContext found for the given node and the remaining Graph.
Does the key i match the prefix p (up to but not including bit m)?
Return both the result of a parse and a chunk of input that was consumed during parsing. This relies on the change of the stateOffset value to evaluate how many tokens were consumed. If you mess with it manually in the argument parser, prepare for troubles.
Matches the given Pattern against the given FilePath, returning True if the pattern matches and False otherwise.
Type of matching to use, if any
Pattern match on a CoRec by specifying handlers for each case. Note that the order of the Handlers has to match the type level list (t:ts).
>>> :{
let testCoRec = Col (Identity False) :: CoRec Identity [Int, String, Bool] in
match testCoRec $
(H $ \i -> "my Int is the successor of " ++ show (i - 1))
:& (H $ \s -> "my String is: " ++ s)
:& (H $ \b -> "my Bool is not: " ++ show (not b) ++ " thus it is " ++ show b)
:& RNil
:}
"my Bool is not: True thus it is False"
"Pattern match" on a Context
match (insert k v ctx) = Just (k, v, ctx)
match  empty           = Nothing
Match a Pattern against a Text input, returning all possible solutions The Pattern must match the entire Text
Match against any message of the right type
match Matches a compiled regular expression against a given subject string, using a matching algorithm that is similar to Perl's. If the subject string doesn't match the regular expression, Nothing is returned, otherwise the portion of the string that matched is returned, along with any captured subpatterns. The arguments are:
  • regex, a PCRE regular expression value produced by compile
  • subject, the subject string to match against
  • options, an optional set of exec-time flags to exec.
Available runtime options are: The result value, and any captured subpatterns, are returned. If the regex is invalid, or the subject string is empty, Nothing is returned.
match Matches a compiled regular expression against a given subject string, using a matching algorithm that is similar to Perl's. If the subject string doesn't match the regular expression, Nothing is returned, otherwise the portion of the string that matched is returned, along with any captured subpatterns. The arguments are:
  • regex, a PCRE regular expression value produced by compile
  • subject, the subject string to match against
  • options, an optional set of exec-time flags to exec.
Available runtime options are:
  • anchored - Match only at the first position
  • bsr_anycrlf - '\R' matches only CR, LF, or CRLF
  • bsr_unicode - '\R' matches all Unicode line endings
  • newline_any - Recognize any Unicode newline sequence
  • newline_anycrlf - Recognize CR, LF, and CRLF as newline sequences
  • newline_cr - Set CR as the newline sequence
  • newline_crlf - Set CRLF as the newline sequence
  • newline_lf - Set LF as the newline sequence
  • notbol - Subject is not the beginning of a line
  • noteol - Subject is not the end of a line
  • notempty - An empty string is not a valid match
  • no_utf8_check - Do not check the subject for UTF-8
  • partial - Return PCRE_ERROR_PARTIAL for a partial match
The result value, and any captured subpatterns, are returned. If the regex is invalid, or the subject string is empty, Nothing is returned.
Add a selection of which source files to process (using the given glob pattern) to the given remaining Rules value. The expanded, relative path of the matched source file on disk (relative to the project directory configured with providerDirectory) becomes the identifier under which the compilation result is saved to the Store (in case you want to load it within another rule). See Identifier for details.

Examples

Select all markdown files within a directory (but without subdirectories)
-- Match all Markdown files in the immediate 'posts' directory
-- e.g. '<project-directory>/posts/hakyll.md'
-- but NOT  '<project-directory>/posts/haskell/monad.md'
match "posts/*.md" $ do
route $ setExtension "html"
compile pandocCompiler
Select all markdown files within a directory (including subdirectories recursively)
-- Match all Markdown files in the 'posts' directory and any subdirectory
-- e.g. '<project-directory>/posts/hakyll.md'
-- and  '<project-directory>/posts/haskell/monad.md'
match "posts/**.md" $ do
route $ setExtension "html"
compile pandocCompiler
See Pattern or search "glob patterns" online for more details. To control where the compilation result will be written out, use routing functions like setExtension.
Attempt to match a string of symbols against the regular expression. Note that the whole string (not just some part of it) should be matched. Examples:
Text.Regex.Applicative> match (sym 'a' <|> sym 'b') "a"
Just 'a'
Text.Regex.Applicative> match (sym 'a' <|> sym 'b') "ab"
Nothing
Given a query, find the longest prefix with an associated value in the trie, and return that prefix, its value, and the remainder of the query.
Like ?==, but returns Nothing on if there is no match, otherwise Just with the list of fragments matching each wildcard. For example:
isJust (match p x) == (p ?== x)
match "**/*.c" "test.txt" == Nothing
match "**/*.c" "foo.c" == Just ["","foo"]
match "**/*.c" "bar/baz/foo.c" == Just ["bar/baz/","foo"]
On Windows any \ path separators will be replaced by /.
General function to create bidirectional converters for key-value pairs. In order to use this function you need to create TomlBiMap for your type and AnyValue:
_MyType :: TomlBiMap MyType AnyValue
And then you can create codec for your type using match function:
myType :: Key -> TomlCodec MyType
myType = match _MyType
Use with caseE