diff options
author | Sam T <sta.cs.vsu@gmail.com> | 2013-04-04 17:44:09 +0400 |
---|---|---|
committer | Sam T <sta.cs.vsu@gmail.com> | 2013-04-04 17:44:09 +0400 |
commit | 937ffe2f497b07d8db2033c95d346d963ea9cc57 (patch) | |
tree | 29e53316a10f97fb6b7f5672a22bd851508e3a9c /src/Data/Torrent.hs | |
parent | 0ed2dc1155d4de0283c8d6a1e44507083426a9a3 (diff) |
remove unneccessary dependencies
Diffstat (limited to 'src/Data/Torrent.hs')
-rw-r--r-- | src/Data/Torrent.hs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Data/Torrent.hs b/src/Data/Torrent.hs index 53ec4ff8..128c1c7c 100644 --- a/src/Data/Torrent.hs +++ b/src/Data/Torrent.hs | |||
@@ -15,7 +15,7 @@ import qualified Data.ByteString.Char8 as BC (pack, unpack) | |||
15 | import Data.Text (Text) | 15 | import Data.Text (Text) |
16 | import Crypto.Hash.SHA1 | 16 | import Crypto.Hash.SHA1 |
17 | import Data.BEncode | 17 | import Data.BEncode |
18 | import Network.URL | 18 | import Network.URI |
19 | 19 | ||
20 | type Time = Text | 20 | type Time = Text |
21 | 21 | ||
@@ -23,15 +23,15 @@ type Time = Text | |||
23 | -- TODO more convenient form of torrent info. | 23 | -- TODO more convenient form of torrent info. |
24 | data Torrent = Torrent { | 24 | data Torrent = Torrent { |
25 | tInfoHash :: ByteString | 25 | tInfoHash :: ByteString |
26 | , tAnnounce :: URL | 26 | , tAnnounce :: URI |
27 | , tAnnounceList :: Maybe [[URL]] | 27 | , tAnnounceList :: Maybe [[URI]] |
28 | , tComment :: Maybe Text | 28 | , tComment :: Maybe Text |
29 | , tCreatedBy :: Maybe ByteString | 29 | , tCreatedBy :: Maybe ByteString |
30 | , tCreationDate :: Maybe Time | 30 | , tCreationDate :: Maybe Time |
31 | , tEncoding :: Maybe ByteString | 31 | , tEncoding :: Maybe ByteString |
32 | , tInfo :: TorrentInfo | 32 | , tInfo :: TorrentInfo |
33 | , tPublisher :: Maybe URL | 33 | , tPublisher :: Maybe URI |
34 | , tPublisherURL :: Maybe URL | 34 | , tPublisherURL :: Maybe URI |
35 | } deriving Show | 35 | } deriving Show |
36 | 36 | ||
37 | data TorrentInfo = | 37 | data TorrentInfo = |
@@ -59,11 +59,11 @@ data TorrentFile = TorrentFile { | |||
59 | , tfPath :: [ByteString] | 59 | , tfPath :: [ByteString] |
60 | } deriving (Show, Read, Eq) | 60 | } deriving (Show, Read, Eq) |
61 | 61 | ||
62 | instance BEncodable URL where | 62 | instance BEncodable URI where |
63 | toBEncode = toBEncode . BC.pack . exportURL -- TODO utf8 encoding | 63 | toBEncode uri = toBEncode (BC.pack (uriToString id uri "")) |
64 | {-# INLINE toBEncode #-} | 64 | {-# INLINE toBEncode #-} |
65 | 65 | ||
66 | fromBEncode (BString s) | Just url <- importURL (BC.unpack s) = return url | 66 | fromBEncode (BString s) | Just url <- parseURI (BC.unpack s) = return url |
67 | fromBEncode b = decodingError $ "url <" ++ show b ++ ">" | 67 | fromBEncode b = decodingError $ "url <" ++ show b ++ ">" |
68 | {-# INLINE fromBEncode #-} | 68 | {-# INLINE fromBEncode #-} |
69 | 69 | ||