summaryrefslogtreecommitdiff
path: root/cryptonite-backport/Crypto/Internal/DeepSeq.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2017-09-15 04:40:28 -0400
committerjoe <joe@jerkface.net>2017-09-15 04:40:28 -0400
commit9605ede14705ef81dde2ff58ecddd66cf3adb13f (patch)
treed708c4088eae04825cbbabd99958ef593560a62b /cryptonite-backport/Crypto/Internal/DeepSeq.hs
parentd830e5d9a18646e8f9fecf4ce74ac0250a3e9021 (diff)
Separated back-ported cryptonite files.
Diffstat (limited to 'cryptonite-backport/Crypto/Internal/DeepSeq.hs')
-rw-r--r--cryptonite-backport/Crypto/Internal/DeepSeq.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/cryptonite-backport/Crypto/Internal/DeepSeq.hs b/cryptonite-backport/Crypto/Internal/DeepSeq.hs
new file mode 100644
index 00000000..9da79881
--- /dev/null
+++ b/cryptonite-backport/Crypto/Internal/DeepSeq.hs
@@ -0,0 +1,33 @@
1-- |
2-- Module : Crypto.Internal.DeepSeq
3-- License : BSD-style
4-- Maintainer : Vincent Hanquez <vincent@snarc.org>
5-- Stability : experimental
6-- Portability : unknown
7--
8-- Simple abstraction module to allow compilation without deepseq
9-- by defining our own NFData class if not compiling with deepseq
10-- support.
11--
12{-# LANGUAGE CPP #-}
13module Crypto.Internal.DeepSeq
14 ( NFData(..)
15 ) where
16
17#ifdef WITH_DEEPSEQ_SUPPORT
18import Control.DeepSeq
19#else
20import Data.Word
21import Data.ByteArray
22
23class NFData a where rnf :: a -> ()
24
25instance NFData Word8 where rnf w = w `seq` ()
26instance NFData Word16 where rnf w = w `seq` ()
27instance NFData Word32 where rnf w = w `seq` ()
28instance NFData Word64 where rnf w = w `seq` ()
29
30instance NFData Bytes where rnf b = b `seq` ()
31instance NFData ScrubbedBytes where rnf b = b `seq` ()
32
33#endif