serokell-util-0.1.4.0: General-purpose functions by Serokell

Safe HaskellNone
LanguageHaskell2010

Serokell.Util.Verify

Contents

Description

General-purpose utility functions

Synopsis

Documentation

Helpers

Verification

verifyGeneric :: [(Bool, Text)] -> VerificationRes Source #

This function takes list of (predicate, message) pairs and checks each predicate. If predicate is False it's considered an error. If there is at least one error this function returns VerFailure, otherwise VerSuccess is returned. It's useful to verify some data before using it. Example usage: `verifyGeneric [(checkA, "A is bad"), (checkB, "B is bad")]`

Prety printing

buildVerResFull :: VerificationRes -> Builder Source #

Format VerificationRes in a pretty way using all errors messages for VerFailure.

buildVerResSingle :: VerificationRes -> Builder Source #

Format VerificationRes in a pretty way using only first message for VerFailure.

formatAllErrors :: [Text] -> Text Source #

Pretty printer for errors from VerFailure, all errors are printed.

formatFirstError :: [Text] -> Text Source #

Pretty printer for errors from VerFailure, only first error is printed.

verResFullF :: Format r (VerificationRes -> r) Source #

Formatter based on buildVerResFull.

verResSingleF :: Format r (VerificationRes -> r) Source #

Formatter based on buildVerResSingle.