summaryrefslogtreecommitdiff
path: root/src/Data/Word64RangeMap.hs
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-05-23 23:05:51 +0000
committerJames Crayne <jim.crayne@gmail.com>2018-05-23 23:41:03 +0000
commit9d66c754088fd935e56ad2bdd91721ba93e809a7 (patch)
treeaa3928f3b67f677790366ac1f433be8ba4990ee8 /src/Data/Word64RangeMap.hs
parent16851ba2417933dd83ee1e7b91964e7e58b78d85 (diff)
rangemap integration
Conflicts: dht-client.cabal src/Network/Tox/Crypto/Handlers.hs
Diffstat (limited to 'src/Data/Word64RangeMap.hs')
-rw-r--r--src/Data/Word64RangeMap.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Data/Word64RangeMap.hs b/src/Data/Word64RangeMap.hs
index b5cbe9d1..c754c226 100644
--- a/src/Data/Word64RangeMap.hs
+++ b/src/Data/Word64RangeMap.hs
@@ -15,6 +15,8 @@ import Data.Array.MArray (MArray(..))
15import qualified Data.Array.Base as Base 15import qualified Data.Array.Base as Base
16import Data.Reference 16import Data.Reference
17import Debug.Trace 17import Debug.Trace
18import Control.Concurrent.STM
19import Control.Concurrent.STM.TArray
18import Data.Array.IO 20import Data.Array.IO
19import Data.IORef 21import Data.IORef
20 22
@@ -58,6 +60,11 @@ instance (Reference r m, MArray ma e m) => MArray (RefArray r ma) e m where
58 unsafeWrite (RefArray r) i e = modifyRef r (\x -> Base.unsafeWrite x i e >> return (x,())) 60 unsafeWrite (RefArray r) i e = modifyRef r (\x -> Base.unsafeWrite x i e >> return (x,()))
59-} 61-}
60 62
63emptySTMRangeMap :: STM (RangeMap TArray Word8 TVar)
64emptySTMRangeMap = RefArray <$>
65 (newTVar =<<
66 newListArray (0,-1) [])
67
61-- | a sample RangeMap for easier debugging 68-- | a sample RangeMap for easier debugging
62getX :: IO (RangeMap IOArray Word8 IORef) 69getX :: IO (RangeMap IOArray Word8 IORef)
63getX = RefArray <$> 70getX = RefArray <$>