    {-# LANGUAGE ForeignFunctionInterface #-}
    {-# LANGUAGE CApiFFI                  #-}
    module OpenSSL.ERR
        ( getError
        , peekError

        , errorString
        )
        where
    import Foreign
    import Foreign.C

    foreign import capi unsafe "openssl/err.h ERR_get_error"
        getError :: IO CULong

    foreign import capi unsafe "openssl/err.h ERR_peek_error"
        peekError :: IO CULong

    foreign import capi unsafe "openssl/err.h ERR_error_string"
        _error_string :: CULong -> CString -> IO CString

    errorString :: CULong -> IO String
    errorString :: CULong -> IO String
    errorString CULong
    code
        = CULong -> CString -> IO CString
    _error_string CULong
    code CString
    forall a. Ptr a
    nullPtr IO CString -> (CString -> IO String) -> IO String
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= CString -> IO String
    peekCString