module Cardano.Crypto.Libsodium.Init (
sodiumInit,
) where
import Control.Monad (unless)
import Cardano.Crypto.Libsodium.C
sodiumInit :: IO ()
sodiumInit :: IO ()
sodiumInit = do
Int
res <- IO Int
c_sodium_init
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Int
res forall a. Eq a => a -> a -> Bool
== Int
0 Bool -> Bool -> Bool
|| Int
res forall a. Eq a => a -> a -> Bool
== Int
1) forall a b. (a -> b) -> a -> b
$ forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"sodium_init failed"