summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Data/Torrent.hs6
-rw-r--r--src/Network/BitTorrent.hs2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs
index 3175e151..068e9cb6 100644
--- a/src/Data/Torrent.hs
+++ b/src/Data/Torrent.hs
@@ -55,6 +55,8 @@ import Prelude hiding (sum)
55 55
56import Control.Applicative 56import Control.Applicative
57import Control.Arrow 57import Control.Arrow
58import Control.Exception
59import Control.Monad
58import Data.BEncode as BE 60import Data.BEncode as BE
59import Data.Char 61import Data.Char
60import Data.Foldable 62import Data.Foldable
@@ -353,8 +355,8 @@ isMultiFile MultiFile {} = True
353isMultiFile _ = False 355isMultiFile _ = False
354 356
355-- | Read and decode a .torrent file. 357-- | Read and decode a .torrent file.
356fromFile :: FilePath -> IO (Result Torrent) 358fromFile :: FilePath -> IO Torrent
357fromFile filepath = decoded <$> B.readFile filepath 359fromFile = B.readFile >=> either (throwIO . userError) return . decoded
358 360
359{----------------------------------------------------------------------- 361{-----------------------------------------------------------------------
360 Info hash 362 Info hash
diff --git a/src/Network/BitTorrent.hs b/src/Network/BitTorrent.hs
index 61185d08..c37129cb 100644
--- a/src/Network/BitTorrent.hs
+++ b/src/Network/BitTorrent.hs
@@ -28,6 +28,8 @@ import Network.BitTorrent.Peer as BT
28import Network.BitTorrent.Exchange as BT 28import Network.BitTorrent.Exchange as BT
29import Network.BitTorrent.Tracker as BT 29import Network.BitTorrent.Tracker as BT
30 30
31-- discover should hide tracker and DHT communication under the hood
32-- thus we can obtain unified interface
31 33
32discover :: SwarmSession -> (TSession -> IO a) -> IO a 34discover :: SwarmSession -> (TSession -> IO a) -> IO a
33discover SwarmSession {..} action = do 35discover SwarmSession {..} action = do