From 11987749fc6e6d3e53ea737d46d5ab13a16faeb8 Mon Sep 17 00:00:00 2001 From: James Crayne Date: Sat, 28 Sep 2019 13:43:29 -0400 Subject: Factor out some new libraries word64-map: Data.Word64Map network-addr: Network.Address tox-crypto: Crypto.Tox lifted-concurrent: Control.Concurrent.Lifted.Instrument Control.Concurrent.Async.Lifted.Instrument psq-wrap: Data.Wrapper.PSQInt Data.Wrapper.PSQ minmax-psq: Data.MinMaxPSQ tasks: Control.Concurrent.Tasks kad: Network.Kademlia Network.Kademlia.Bootstrap Network.Kademlia.Routing Network.Kademlia.CommonAPI Network.Kademlia.Persistence Network.Kademlia.Search --- cryptonite-backport/Crypto/Internal/ByteArray.hs | 19 ---------- cryptonite-backport/Crypto/Internal/Compat.hs | 48 ------------------------ cryptonite-backport/Crypto/Internal/DeepSeq.hs | 33 ---------------- cryptonite-backport/Crypto/Internal/Imports.hs | 16 -------- 4 files changed, 116 deletions(-) delete mode 100644 cryptonite-backport/Crypto/Internal/ByteArray.hs delete mode 100644 cryptonite-backport/Crypto/Internal/Compat.hs delete mode 100644 cryptonite-backport/Crypto/Internal/DeepSeq.hs delete mode 100644 cryptonite-backport/Crypto/Internal/Imports.hs (limited to 'cryptonite-backport/Crypto/Internal') diff --git a/cryptonite-backport/Crypto/Internal/ByteArray.hs b/cryptonite-backport/Crypto/Internal/ByteArray.hs deleted file mode 100644 index 3a23152d..00000000 --- a/cryptonite-backport/Crypto/Internal/ByteArray.hs +++ /dev/null @@ -1,19 +0,0 @@ --- | --- Module : Crypto.Internal.ByteArray --- License : BSD-style --- Maintainer : Vincent Hanquez --- Stability : stable --- Portability : Good --- --- Simple and efficient byte array types --- -{-# OPTIONS_HADDOCK hide #-} -module Crypto.Internal.ByteArray - ( module Data.ByteArray - , module Data.ByteArray.Mapping - , module Data.ByteArray.Encoding - ) where - -import Data.ByteArray -import Data.ByteArray.Mapping -import Data.ByteArray.Encoding diff --git a/cryptonite-backport/Crypto/Internal/Compat.hs b/cryptonite-backport/Crypto/Internal/Compat.hs deleted file mode 100644 index a3712a7c..00000000 --- a/cryptonite-backport/Crypto/Internal/Compat.hs +++ /dev/null @@ -1,48 +0,0 @@ --- | --- Module : Crypto.Internal.Compat --- License : BSD-style --- Maintainer : Vincent Hanquez --- Stability : stable --- Portability : Good --- --- This module try to keep all the difference between versions of base --- or other needed packages, so that modules don't need to use CPP --- -{-# LANGUAGE CPP #-} -module Crypto.Internal.Compat - ( unsafeDoIO - , popCount - , byteSwap64 - ) where - -import System.IO.Unsafe -import Data.Word -import Data.Bits - --- | perform io for hashes that do allocation and ffi. --- unsafeDupablePerformIO is used when possible as the --- computation is pure and the output is directly linked --- to the input. we also do not modify anything after it has --- been returned to the user. -unsafeDoIO :: IO a -> a -#if __GLASGOW_HASKELL__ > 704 -unsafeDoIO = unsafeDupablePerformIO -#else -unsafeDoIO = unsafePerformIO -#endif - -#if !(MIN_VERSION_base(4,5,0)) -popCount :: Word64 -> Int -popCount n = loop 0 n - where loop c 0 = c - loop c i = loop (c + if testBit c 0 then 1 else 0) (i `shiftR` 1) -#endif - -#if !(MIN_VERSION_base(4,7,0)) -byteSwap64 :: Word64 -> Word64 -byteSwap64 w = - (w `shiftR` 56) .|. (w `shiftL` 56) - .|. ((w `shiftR` 40) .&. 0xff00) .|. ((w .&. 0xff00) `shiftL` 40) - .|. ((w `shiftR` 24) .&. 0xff0000) .|. ((w .&. 0xff0000) `shiftL` 24) - .|. ((w `shiftR` 8) .&. 0xff000000) .|. ((w .&. 0xff000000) `shiftL` 8) -#endif diff --git a/cryptonite-backport/Crypto/Internal/DeepSeq.hs b/cryptonite-backport/Crypto/Internal/DeepSeq.hs deleted file mode 100644 index 9da79881..00000000 --- a/cryptonite-backport/Crypto/Internal/DeepSeq.hs +++ /dev/null @@ -1,33 +0,0 @@ --- | --- Module : Crypto.Internal.DeepSeq --- License : BSD-style --- Maintainer : Vincent Hanquez --- Stability : experimental --- Portability : unknown --- --- Simple abstraction module to allow compilation without deepseq --- by defining our own NFData class if not compiling with deepseq --- support. --- -{-# LANGUAGE CPP #-} -module Crypto.Internal.DeepSeq - ( NFData(..) - ) where - -#ifdef WITH_DEEPSEQ_SUPPORT -import Control.DeepSeq -#else -import Data.Word -import Data.ByteArray - -class NFData a where rnf :: a -> () - -instance NFData Word8 where rnf w = w `seq` () -instance NFData Word16 where rnf w = w `seq` () -instance NFData Word32 where rnf w = w `seq` () -instance NFData Word64 where rnf w = w `seq` () - -instance NFData Bytes where rnf b = b `seq` () -instance NFData ScrubbedBytes where rnf b = b `seq` () - -#endif diff --git a/cryptonite-backport/Crypto/Internal/Imports.hs b/cryptonite-backport/Crypto/Internal/Imports.hs deleted file mode 100644 index 4ed44e16..00000000 --- a/cryptonite-backport/Crypto/Internal/Imports.hs +++ /dev/null @@ -1,16 +0,0 @@ --- | --- Module : Crypto.Internal.Imports --- License : BSD-style --- Maintainer : Vincent Hanquez --- Stability : experimental --- Portability : unknown --- -module Crypto.Internal.Imports - ( module X - ) where - -import Data.Word as X -import Control.Applicative as X -import Control.Monad as X (forM, forM_, void) -import Control.Arrow as X (first, second) -import Crypto.Internal.DeepSeq as X -- cgit v1.2.3