Skip to content
Browse files

Using "-- |" instead of "{-|".

  • Loading branch information...
1 parent cb69620 commit cc865669bcdb812d373caccb00cd04e18a0b678c @kazu-yamamoto committed
Showing with 25 additions and 49 deletions.
  1. +5 −4 Network/DNS/Encode.hs
  2. +10 −30 Network/DNS/Internal.hs
  3. +8 −12 Network/DNS/Resolver.hs
  4. +2 −3 Network/DNS/Types.hs
View
9 Network/DNS/Encode.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE RecordWildCards #-}
+
module Network.DNS.Encode (
encode
, composeQuery
@@ -20,8 +21,8 @@ import Data.IP
----------------------------------------------------------------
-{-| Composing query. First argument is a number to identify response.
--}
+-- | Composing query. First argument is a number to identify response.
+
composeQuery :: Int -> [Question] -> BL.ByteString
composeQuery idt qs = encode qry
where
@@ -36,8 +37,8 @@ composeQuery idt qs = encode qry
----------------------------------------------------------------
-{-| Composing DNS data.
--}
+-- | Composing DNS data.
+
encode :: DNSFormat -> BL.ByteString
encode fmt = runSPut (encodeDNSFormat fmt)
View
40 Network/DNS/Internal.hs
@@ -8,16 +8,12 @@ import Data.Maybe
----------------------------------------------------------------
-{-|
- Type for domain.
--}
+-- | Type for domain.
type Domain = ByteString
----------------------------------------------------------------
-{-|
- Types for resource records.
--}
+-- | Types for resource records.
data TYPE = A | AAAA | NS | TXT | MX | CNAME | SOA | PTR | SRV
| UNKNOWN Int deriving (Eq, Show, Read)
@@ -51,9 +47,7 @@ toType = read . map toUpper
----------------------------------------------------------------
-{-|
- An enumeration of all possible DNS errors that can occur.
--}
+-- | An enumeration of all possible DNS errors that can occur.
data DNSError =
-- | The sequence number of the answer doesn't match our query. This
-- could indicate foul play.
@@ -65,9 +59,7 @@ data DNSError =
| UnexpectedRDATA
deriving (Eq, Show)
-{-|
- Raw data format for DNS Query and Response.
--}
+-- | Raw data format for DNS Query and Response.
data DNSFormat = DNSFormat {
header :: DNSHeader
, question :: [Question]
@@ -76,9 +68,7 @@ data DNSFormat = DNSFormat {
, additional :: [ResourceRecord]
} deriving (Eq, Show)
-{-|
- Raw data format for the header of DNS Query and Response.
--}
+-- | Raw data format for the header of DNS Query and Response.
data DNSHeader = DNSHeader {
identifier :: Int
, flags :: DNSFlags
@@ -88,9 +78,7 @@ data DNSHeader = DNSHeader {
, arCount :: Int
} deriving (Eq, Show)
-{-|
- Raw data format for the flags of DNS Query and Response.
--}
+-- | Raw data format for the flags of DNS Query and Response.
data DNSFlags = DNSFlags {
qOrR :: QorR
, opcode :: OPCODE
@@ -111,25 +99,19 @@ data RCODE = NoErr | FormatErr | ServFail | NameErr | NotImpl | Refused deriving
----------------------------------------------------------------
-{-|
- Raw data format for DNS questions.
--}
+-- | Raw data format for DNS questions.
data Question = Question {
qname :: Domain
, qtype :: TYPE
} deriving (Eq, Show)
-{-|
- Making "Question".
--}
+-- | Making "Question".
makeQuestion :: Domain -> TYPE -> Question
makeQuestion = Question
----------------------------------------------------------------
-{-|
- Raw data format for resource records.
--}
+-- | Raw data format for resource records.
data ResourceRecord = ResourceRecord {
rrname :: Domain
, rrtype :: TYPE
@@ -138,9 +120,7 @@ data ResourceRecord = ResourceRecord {
, rdata :: RDATA
} deriving (Eq, Show)
-{-|
- Raw data format for each type.
--}
+-- | Raw data format for each type.
data RDATA = RD_NS Domain | RD_CNAME Domain | RD_MX Int Domain | RD_PTR Domain
| RD_SOA Domain Domain Int Int Int Int Int
| RD_A IPv4 | RD_AAAA IPv6 | RD_TXT ByteString
View
20 Network/DNS/Resolver.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
+
-- | DNS Resolver and generic (lower-level) lookup functions.
module Network.DNS.Resolver (
-- * Documentation
@@ -79,18 +80,14 @@ defaultResolvConf = ResolvConf {
----------------------------------------------------------------
-{-|
- Abstract data type of DNS Resolver seed
--}
+-- | Abstract data type of DNS Resolver seed
data ResolvSeed = ResolvSeed {
addrInfo :: AddrInfo
, rsTimeout :: Int
, rsBufsize :: Integer
}
-{-|
- Abstract data type of DNS Resolver
--}
+-- | Abstract data type of DNS Resolver
data Resolver = Resolver {
genId :: IO Int
, dnsSock :: Socket
@@ -154,12 +151,11 @@ getRandom = getStdRandom (randomR (0,65535))
----------------------------------------------------------------
-{-|
- Looking up resource records of a domain. The first parameter is one of
- the field accessors of the 'DNSFormat' type -- this allows you to
- choose which section (answer, authority, or additional) you would like
- to inspect for the result.
--}
+-- | Looking up resource records of a domain. The first parameter is one of
+-- the field accessors of the 'DNSFormat' type -- this allows you to
+-- choose which section (answer, authority, or additional) you would like
+-- to inspect for the result.
+
lookupSection :: (DNSFormat -> [ResourceRecord])
-> Resolver
-> Domain
View
5 Network/DNS/Types.hs
@@ -1,6 +1,5 @@
-{-|
- Data types for DNS Query and Response. For more information, see <http://www.ietf.org/rfc/rfc1035>.
--}
+-- | Data types for DNS Query and Response.
+-- For more information, see <http://www.ietf.org/rfc/rfc1035>.
module Network.DNS.Types (
-- * Domain

0 comments on commit cc86566

Please sign in to comment.
Something went wrong with that request. Please try again.