matchM

Eliminate all specified values a from f (Either a b) by replacing each of them with a given f a.
Every monad is a multi-way selective functor.
Try to run an effectful function, on pattern match fail behave like pure
>>> matchM (\'a' -> Just 'A') 'a'
Just 'A'

>>> matchM (\'a' -> Just 'A') 'x'
Just 'x'
Match against any message, regardless of the underlying (contained) type
Match against any message (regardless of underlying type) that satisfies a predicate
If set, only receives signals sent with the given member name.
Add a selection of which source files to process (using the given glob pattern and metadata predicate) to the given remaining Rules values. Same as match but allows to filter files further based on their (metadata) content (a file is added only when the metadata predicate returns True). 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 with enabled draft flag within a directory
matchMetadata "posts/*.md" (\meta -> maybe False (=="true") $ lookupString "draft" meta) $ do
route $ setExtension "html"
compile pandocCompiler
For example, the following 'posts/hakyll.md' file with draft: true metadata would match:
---
draft: true
title: Hakyll Post
...
---
In this blog post we learn about Hakyll ...
Note that files that have draft: false or no such draft field at all, would not match. You can use helper functions like lookupString to access a specific metadata field, and maybe to work with Maybe. To control where the compilation result will be written out, use routing functions like setExtension.
Efficiently match many FilePatterns against many FilePaths in a single operation. Note that the returned matches are not guaranteed to be in any particular order.
matchMany [(a, pat)] [(b, path)] == maybeToList (map (a,b,) (match pat path))
finding all matches
Use a Haskell \case expression to pattern match on a MaybeFields.
example :: MaybeFields (Field SqlInt4) -> Field SqlInt4
example mf = matchMaybe mf $ \case
Nothing -> 0
Just x  -> x * 100
error and warning message body
Mark values in the first pattern which match with at least one value in the second pattern.
instances of this class provide a variety of ways to match on the Request method. Examples:
method GET                  -- match GET or HEAD
method [GET, POST]          -- match GET, HEAD or POST
method HEAD                 -- match HEAD /but not/ GET
method (== GET)             -- match GET or HEAD
method (not . (==) DELETE)  -- match any method except DELETE
method ()                   -- match any method
As you can see, GET implies that HEAD should match as well. This is to make it harder to write an application that uses HTTP incorrectly. Happstack handles HEAD requests automatically, but we still need to make sure our handlers don't mismatch or a HEAD will result in a 404. If you must, you can still do something like this to match GET without HEAD:
guardRq ((== GET) . rqMethod)
A message emitted while matching a TOML value. The message is paired with the path to the value that was in focus when the message was generated. These message get used for both warnings and errors. For a convenient way to render these to a string, see prettyMatchMessage.