summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/DHT/Session.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Network/BitTorrent/DHT/Session.hs')
-rw-r--r--src/Network/BitTorrent/DHT/Session.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/DHT/Session.hs b/src/Network/BitTorrent/DHT/Session.hs
index 38b3ed11..bc5c6201 100644
--- a/src/Network/BitTorrent/DHT/Session.hs
+++ b/src/Network/BitTorrent/DHT/Session.hs
@@ -10,6 +10,7 @@
10-- to. Normally, you don't need to import this module, use 10-- to. Normally, you don't need to import this module, use
11-- "Network.BitTorrent.DHT" instead. 11-- "Network.BitTorrent.DHT" instead.
12-- 12--
13{-# LANGUAGE CPP #-}
13{-# LANGUAGE RecordWildCards #-} 14{-# LANGUAGE RecordWildCards #-}
14{-# LANGUAGE FlexibleContexts #-} 15{-# LANGUAGE FlexibleContexts #-}
15{-# LANGUAGE FlexibleInstances #-} 16{-# LANGUAGE FlexibleInstances #-}
@@ -258,10 +259,20 @@ newtype DHT ip a = DHT { unDHT :: ReaderT (Node ip) IO a }
258 , MonadBase IO, MonadReader (Node ip), MonadThrow 259 , MonadBase IO, MonadReader (Node ip), MonadThrow
259 ) 260 )
260 261
262#if MIN_VERSION_monad_control(1,0,0)
263newtype DHTStM ip a = StM {
264 unSt :: StM (ReaderT (Node ip) IO) a
265 }
266#endif
267
261instance MonadBaseControl IO (DHT ip) where 268instance MonadBaseControl IO (DHT ip) where
269#if MIN_VERSION_monad_control(1,0,0)
270 type StM (DHT ip) a = DHTStM ip a
271#else
262 newtype StM (DHT ip) a = StM { 272 newtype StM (DHT ip) a = StM {
263 unSt :: StM (ReaderT (Node ip) IO) a 273 unSt :: StM (ReaderT (Node ip) IO) a
264 } 274 }
275#endif
265 liftBaseWith cc = DHT $ liftBaseWith $ \ cc' -> 276 liftBaseWith cc = DHT $ liftBaseWith $ \ cc' ->
266 cc $ \ (DHT m) -> StM <$> cc' m 277 cc $ \ (DHT m) -> StM <$> cc' m
267 {-# INLINE liftBaseWith #-} 278 {-# INLINE liftBaseWith #-}