summaryrefslogtreecommitdiff
path: root/src/Data/Torrent.hs
diff options
context:
space:
mode:
authorSam T <sta.cs.vsu@gmail.com>2013-04-04 17:44:09 +0400
committerSam T <sta.cs.vsu@gmail.com>2013-04-04 17:44:09 +0400
commit937ffe2f497b07d8db2033c95d346d963ea9cc57 (patch)
tree29e53316a10f97fb6b7f5672a22bd851508e3a9c /src/Data/Torrent.hs
parent0ed2dc1155d4de0283c8d6a1e44507083426a9a3 (diff)
remove unneccessary dependencies
Diffstat (limited to 'src/Data/Torrent.hs')
-rw-r--r--src/Data/Torrent.hs16
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)
15import Data.Text (Text) 15import Data.Text (Text)
16import Crypto.Hash.SHA1 16import Crypto.Hash.SHA1
17import Data.BEncode 17import Data.BEncode
18import Network.URL 18import Network.URI
19 19
20type Time = Text 20type 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.
24data Torrent = Torrent { 24data 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
37data TorrentInfo = 37data 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
62instance BEncodable URL where 62instance 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