summaryrefslogtreecommitdiff
path: root/src/Data/Torrent
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Torrent')
-rw-r--r--src/Data/Torrent/Client.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Data/Torrent/Client.hs b/src/Data/Torrent/Client.hs
index 96ddd347..6437cbbf 100644
--- a/src/Data/Torrent/Client.hs
+++ b/src/Data/Torrent/Client.hs
@@ -16,7 +16,7 @@
16-- <http://bittorrent.org/beps/bep_0020.html> 16-- <http://bittorrent.org/beps/bep_0020.html>
17-- 17--
18-- 18--
19-- NOTE: Do _not_ use this information to control client 19-- NOTE: Do /not/ use this information to control client
20-- capabilities (such as supported enchancements), this should be 20-- capabilities (such as supported enchancements), this should be
21-- done using 'Network.BitTorrent.Extension'! 21-- done using 'Network.BitTorrent.Extension'!
22-- 22--
@@ -43,9 +43,9 @@ import Text.Read (readMaybe)
43import Paths_bittorrent (version) 43import Paths_bittorrent (version)
44 44
45 45
46-- | List of registered client versions + IlibHSbittorrent (this 46-- | List of registered client versions + 'IlibHSbittorrent' (this
47-- package) + Unknown (for not recognized software). All names are 47-- package) + 'IUnknown' (for not recognized software). All names are
48-- prefixed by "I" because some of them starts from lowercase letter 48-- prefixed by \"I\" because some of them starts from lowercase letter
49-- but that is not a valid Haskell constructor name. 49-- but that is not a valid Haskell constructor name.
50-- 50--
51data ClientImpl = 51data ClientImpl =
@@ -131,6 +131,7 @@ instance Default ClientImpl where
131 def = IUnknown 131 def = IUnknown
132 {-# INLINE def #-} 132 {-# INLINE def #-}
133 133
134-- | Example: @\"BitLet\" == 'IBitLet'@
134instance IsString ClientImpl where 135instance IsString ClientImpl where
135 fromString str 136 fromString str
136 | Just impl <- L.lookup str alist = impl 137 | Just impl <- L.lookup str alist = impl
@@ -139,6 +140,7 @@ instance IsString ClientImpl where
139 alist = L.map mk [minBound..maxBound] 140 alist = L.map mk [minBound..maxBound]
140 mk x = (L.tail $ show x, x) 141 mk x = (L.tail $ show x, x)
141 142
143-- | Example: @pretty 'IBitLet' == \"IBitLet\"@
142instance Pretty ClientImpl where 144instance Pretty ClientImpl where
143 pretty = text . L.tail . show 145 pretty = text . L.tail . show
144 146
@@ -147,6 +149,9 @@ instance Default Version where
147 def = Version [0] [] 149 def = Version [0] []
148 {-# INLINE def #-} 150 {-# INLINE def #-}
149 151
152-- | For dot delimited version strings.
153-- Example: @fromString \"0.1.0.2\" == Version [0, 1, 0, 2]@
154--
150instance IsString Version where 155instance IsString Version where
151 fromString str 156 fromString str
152 | Just nums <- chunkNums str = Version nums [] 157 | Just nums <- chunkNums str = Version nums []
@@ -169,6 +174,7 @@ instance Default ClientInfo where
169 def = ClientInfo def def 174 def = ClientInfo def def
170 {-# INLINE def #-} 175 {-# INLINE def #-}
171 176
177-- | Example: @\"BitComet-1.2\" == ClientInfo IBitComet (Version [1, 2] [])@
172instance IsString ClientInfo where 178instance IsString ClientInfo where
173 fromString str 179 fromString str
174 | _ : ver <- _ver = ClientInfo (fromString impl) (fromString ver) 180 | _ : ver <- _ver = ClientInfo (fromString impl) (fromString ver)