matcher-0.1.1.3: A composable abstraction for checking or converting a context value

Safe HaskellNone
LanguageHaskell2010

Matcher

Synopsis

Documentation

data Matcher a b Source

A composable abstraction for checking or converting a context value.

run :: Matcher a b -> a -> Either Text b Source

Converts the matcher into a conversion function, which results in either a successful result or a failure.

equals :: Eq a => a -> Matcher a () Source

Tests the matched value on equality with the provided value.

satisfies :: (a -> Bool) -> Matcher a () Source

Checks whether the matched value satisfies the provided predicate.

converts :: (a -> Either Text b) -> Matcher a b Source

Tries to convert the matched value to an output value, with Either encoding the success or failure of the conversion.

whatever :: Matcher a () Source

The matcher, which is always satisfied.