serokell-util 0.7.0 → 0.8.0
raw patch · 2 files changed
+8/−7 lines, 2 files
Files
- serokell-util.cabal +1/−1
- src/Serokell/Util/Verify.hs +7/−6
serokell-util.cabal view
@@ -1,5 +1,5 @@ name: serokell-util-version: 0.7.0+version: 0.8.0 synopsis: General-purpose functions by Serokell homepage: https://github.com/serokell/serokell-util license: MIT
src/Serokell/Util/Verify.hs view
@@ -23,6 +23,7 @@ import Universum import Control.Monad.Except (MonadError, throwError)+import Fmt (fmt) import Serokell.Util.Text (listBuilder) @@ -69,15 +70,15 @@ -- | Format VerificationRes in a pretty way using all errors messages -- for VerFailure.-verResFullF :: VerificationRes -> B.Builder+verResFullF :: VerificationRes -> Text verResFullF VerSuccess = "success"-verResFullF (VerFailure errors) = buildVerResImpl errors+verResFullF (VerFailure errors) = fmt $ buildVerResImpl errors -- | Format VerificationRes in a pretty way using only first message -- for VerFailure.-verResSingleF :: VerificationRes -> B.Builder+verResSingleF :: VerificationRes -> Text verResSingleF VerSuccess = "success"-verResSingleF (VerFailure errors) = buildVerResImpl $ one $ head errors+verResSingleF (VerFailure errors) = fmt $ buildVerResImpl $ one $ head errors buildVerResImpl :: NonEmpty Text -> B.Builder buildVerResImpl errors =@@ -86,11 +87,11 @@ -- These two functions can have more general type. -- | Pretty printer for errors from VerFailure, all errors are printed.-formatAllErrors :: NonEmpty Text -> B.Builder+formatAllErrors :: NonEmpty Text -> Text formatAllErrors = verResFullF . VerFailure -- | Pretty printer for errors from VerFailure, only first error is printed.-formatFirstError :: NonEmpty Text -> B.Builder+formatFirstError :: NonEmpty Text -> Text formatFirstError = verResSingleF . VerFailure ----------------------------------------------------------------------------