monadcryptorandom 0.7.0 → 0.7.1
raw patch · 2 files changed
+33/−8 lines, 2 filesdep +exceptionsdep +transformers-compatdep ~mtlPVP ok
version bump matches the API change (PVP)
Dependencies added: exceptions, transformers-compat
Dependency ranges changed: mtl
API changes (from Hackage documentation)
+ Control.Monad.CryptoRandom: instance Control.Monad.Catch.MonadCatch m => Control.Monad.Catch.MonadCatch (Control.Monad.CryptoRandom.CRandT g e m)
+ Control.Monad.CryptoRandom: instance Control.Monad.Catch.MonadThrow m => Control.Monad.Catch.MonadThrow (Control.Monad.CryptoRandom.CRandT g e m)
Files
- Control/Monad/CryptoRandom.hs +20/−5
- monadcryptorandom.cabal +13/−3
Control/Monad/CryptoRandom.hs view
@@ -31,8 +31,10 @@ import Control.Applicative import Control.Arrow (right, left, first) import Control.Monad (liftM)+import qualified Control.Monad.Catch as C (MonadThrow(..), MonadCatch(..)) import Control.Monad.Cont-import Control.Monad.Except+import Control.Monad.Trans.Except+import Control.Monad.Error.Class import Control.Monad.IO.Class import Control.Monad.Identity import Control.Monad.Reader@@ -331,21 +333,34 @@ callCC f = CRandT $ callCC $ \amb -> unCRandT $ f (CRandT . amb) {-# INLINE callCC #-} +-- | Throws exceptions into the base monad.+--+-- @since 0.7.1+instance C.MonadThrow m => C.MonadThrow (CRandT g e m) where+ throwM = CRandT . C.throwM++-- | Catches exceptions from the base monad.+--+-- @since 0.7.1+instance C.MonadCatch m => C.MonadCatch (CRandT g e m) where+ catch (CRandT m) f = CRandT $ C.catch m (unCRandT . f)+ -- |Simple users of generators can use CRand for -- quick and easy generation of randoms. See -- below for a simple use of 'newGenIO' (from "crypto-api"), -- 'getCRandom', 'getBytes', and 'runCRandom'. ----- @getRandPair = do+-- @+-- getRandPair = do -- int <- getCRandom -- bytes <- getBytes 100 -- return (int, bytes) ----- func = do+-- func = do -- g <- newGenIO -- case runCRand getRandPair g of--- Right ((int,bytes), g') -> useRandomVals (int,bytes)--- Left x -> handleGenError x+-- Right ((int,bytes), g') -> useRandomVals (int,bytes)+-- Left x -> handleGenError x -- @ type CRand g e = CRandT g e Identity
monadcryptorandom.cabal view
@@ -1,5 +1,5 @@ name: monadcryptorandom-version: 0.7.0+version: 0.7.1 license: BSD3 license-file: LICENSE copyright: Thomas DuBuisson <thomas.dubuisson@gmail.com>@@ -12,14 +12,24 @@ stability: stable build-type: Simple cabal-version: >= 1.6-tested-with: GHC == 6.12.1+tested-with: GHC == 6.12.1,+ GHC == 7.0.4,+ GHC == 7.2.2,+ GHC == 7.4.2+ GHC == 7.6.3,+ GHC == 7.8.2,+ GHC == 7.10.3 Data-Files: extra-source-files: Library Build-Depends: base == 4.*, bytestring >= 0.9 && < 0.11,- mtl >= 2.2.1, crypto-api >= 0.2, transformers >= 0.2,+ crypto-api >= 0.2,+ exceptions >= 0.8 && <0.9,+ transformers >= 0.2,+ mtl >= 2.0 && < 2.3,+ transformers-compat >= 0.3, tagged >= 0.2 ghc-options: hs-source-dirs: