cryptonite-0.21: Cryptography Primitives sink

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
StabilityStable
PortabilityExcellent
Safe HaskellSafe
LanguageHaskell2010

Crypto.Error

Description

 

Synopsis

Documentation

data CryptoFailable a

A simple Either like type to represent a computation that can fail

2 possibles values are:

  • CryptoPassed : The computation succeeded, and contains the result of the computation
  • CryptoFailed : The computation failed, and contains the cryptographic error associated

throwCryptoErrorIO :: CryptoFailable a -> IO a

Throw an CryptoError as exception on CryptoFailed result, otherwise return the computed value

throwCryptoError :: CryptoFailable a -> a

Same as throwCryptoErrorIO but throw the error asynchronously.

onCryptoFailure :: (CryptoError -> r) -> (a -> r) -> CryptoFailable a -> r

Simple either like combinator for CryptoFailable type

eitherCryptoError :: CryptoFailable a -> Either CryptoError a

Transform a CryptoFailable to an Either

maybeCryptoError :: CryptoFailable a -> Maybe a

Transform a CryptoFailable to a Maybe