diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Data/Torrent.hs | 6 | ||||
-rw-r--r-- | src/Network/BitTorrent.hs | 2 |
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 | ||
56 | import Control.Applicative | 56 | import Control.Applicative |
57 | import Control.Arrow | 57 | import Control.Arrow |
58 | import Control.Exception | ||
59 | import Control.Monad | ||
58 | import Data.BEncode as BE | 60 | import Data.BEncode as BE |
59 | import Data.Char | 61 | import Data.Char |
60 | import Data.Foldable | 62 | import Data.Foldable |
@@ -353,8 +355,8 @@ isMultiFile MultiFile {} = True | |||
353 | isMultiFile _ = False | 355 | isMultiFile _ = False |
354 | 356 | ||
355 | -- | Read and decode a .torrent file. | 357 | -- | Read and decode a .torrent file. |
356 | fromFile :: FilePath -> IO (Result Torrent) | 358 | fromFile :: FilePath -> IO Torrent |
357 | fromFile filepath = decoded <$> B.readFile filepath | 359 | fromFile = 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 | |||
28 | import Network.BitTorrent.Exchange as BT | 28 | import Network.BitTorrent.Exchange as BT |
29 | import Network.BitTorrent.Tracker as BT | 29 | import 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 | ||
32 | discover :: SwarmSession -> (TSession -> IO a) -> IO a | 34 | discover :: SwarmSession -> (TSession -> IO a) -> IO a |
33 | discover SwarmSession {..} action = do | 35 | discover SwarmSession {..} action = do |