export some crypto failable combinators

This commit is contained in:
Vincent Hanquez 2015-04-10 07:23:51 +01:00
parent 02533b43a7
commit 7d1b5117a8

View File

@ -11,6 +11,8 @@
module Crypto.Error.Types
( CryptoError(..)
, CryptoFailable(..)
, throwCryptoErrorIO
, throwCryptoError
) where
import qualified Control.Exception as E
@ -49,10 +51,15 @@ instance Monad CryptoFailable where
CryptoPassed a -> m2 a
CryptoFailed e -> CryptoFailed e
{-
throwCryptoError :: CryptoFailable a -> IO a
throwCryptoError = undefined
throwCryptoErrorIO :: CryptoFailable a -> IO a
throwCryptoErrorIO (CryptoFailed e) = E.throwIO e
throwCryptoErrorIO (CryptoPassed r) = return r
throwCryptoError :: CryptoFailable a -> a
throwCryptoError (CryptoFailed e) = E.throw e
throwCryptoError (CryptoPassed r) = r
{-
eitherCryptoError :: CryptoFailable a -> Either CryptoError a
eitherCryptoError = undefined