diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2014-12-16 12:07:10 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2014-12-16 13:30:08 +0100 |
commit | 554aedab646075e12e53b44df04bcfbccbe03a73 (patch) | |
tree | 0832201a44fd74632bbbd88fb77cb6c11eb34cf7 /libraries/base/Text | |
parent | 45a9696c550c5fe5e891b6d4710179272dc9f6db (diff) | |
download | haskell-554aedab646075e12e53b44df04bcfbccbe03a73.tar.gz |
Convert `/Since: .../` to new `@since ...` syntax
Starting with Haddock 2.16 there's a new built-in support for since-annotations
Note: This exposes a bug in the `@since` implementation (see e.g. `Data.Bits`)
Diffstat (limited to 'libraries/base/Text')
-rw-r--r-- | libraries/base/Text/Printf.hs | 42 | ||||
-rw-r--r-- | libraries/base/Text/Read.hs | 4 | ||||
-rw-r--r-- | libraries/base/Text/Read/Lex.hs | 14 |
3 files changed, 30 insertions, 30 deletions
diff --git a/libraries/base/Text/Printf.hs b/libraries/base/Text/Printf.hs index 6c911daea7..cc8c462688 100644 --- a/libraries/base/Text/Printf.hs +++ b/libraries/base/Text/Printf.hs @@ -311,9 +311,9 @@ instance (PrintfArg a, HPrintfType r) => HPrintfType (a -> r) where -- default 'parseFormat' expects no modifiers: this is the normal -- case. Minimal instance: 'formatArg'. class PrintfArg a where - -- | /Since: 4.7.0.0/ + -- | @since 4.7.0.0 formatArg :: a -> FieldFormatter - -- | /Since: 4.7.0.0/ + -- | @since 4.7.0.0 parseFormat :: a -> ModifierParser parseFormat _ (c : cs) = FormatParse "" c cs parseFormat _ "" = errorShortFormat @@ -384,9 +384,9 @@ instance PrintfArg Double where -- type, is not allowable as a typeclass instance. 'IsChar' -- is exported for backward-compatibility. class IsChar c where - -- | /Since: 4.7.0.0/ + -- | @since 4.7.0.0 toChar :: c -> Char - -- | /Since: 4.7.0.0/ + -- | @since 4.7.0.0 fromChar :: Char -> c instance IsChar Char where @@ -398,19 +398,19 @@ instance IsChar Char where -- | Whether to left-adjust or zero-pad a field. These are -- mutually exclusive, with 'LeftAdjust' taking precedence. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 data FormatAdjustment = LeftAdjust | ZeroPad -- | How to handle the sign of a numeric field. These are -- mutually exclusive, with 'SignPlus' taking precedence. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 data FormatSign = SignPlus | SignSpace -- | Description of field formatting for 'formatArg'. See UNIX `printf`(3) -- for a description of how field formatting works. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 data FieldFormat = FieldFormat { fmtWidth :: Maybe Int, -- ^ Total width of the field. fmtPrecision :: Maybe Int, -- ^ Secondary field width specifier. @@ -444,7 +444,7 @@ data FieldFormat = FieldFormat { -- modifier characters to find the primary format character. -- This is the type of its result. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 data FormatParse = FormatParse { fpModifiers :: String, -- ^ Any modifiers found. fpChar :: Char, -- ^ Primary format character. @@ -486,13 +486,13 @@ parseIntFormat _ s = -- | This is the type of a field formatter reified over its -- argument. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 type FieldFormatter = FieldFormat -> ShowS -- | Type of a function that will parse modifier characters -- from the format string. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 type ModifierParser = String -> FormatParse -- | Substitute a \'v\' format character with the given @@ -500,21 +500,21 @@ type ModifierParser = String -> FormatParse -- convenience for user-implemented types, which should -- support \"%v\". -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 vFmt :: Char -> FieldFormat -> FieldFormat vFmt c ufmt@(FieldFormat {fmtChar = 'v'}) = ufmt {fmtChar = c} vFmt _ ufmt = ufmt -- | Formatter for 'Char' values. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 formatChar :: Char -> FieldFormatter formatChar x ufmt = formatIntegral (Just 0) (toInteger $ ord x) $ vFmt 'c' ufmt -- | Formatter for 'String' values. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 formatString :: IsChar a => [a] -> FieldFormatter formatString x ufmt = case fmtChar $ vFmt 's' ufmt of @@ -539,7 +539,7 @@ fixupMods ufmt m = -- | Formatter for 'Int' values. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 formatInt :: (Integral a, Bounded a) => a -> FieldFormatter formatInt x ufmt = let lb = toInteger $ minBound `asTypeOf` x @@ -552,7 +552,7 @@ formatInt x ufmt = -- | Formatter for 'Integer' values. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 formatInteger :: Integer -> FieldFormatter formatInteger x ufmt = let m = fixupMods ufmt Nothing in @@ -593,7 +593,7 @@ formatIntegral m x ufmt0 = -- | Formatter for 'RealFloat' values. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 formatRealFloat :: RealFloat a => a -> FieldFormatter formatRealFloat x ufmt = let c = fmtChar $ vFmt 'g' ufmt @@ -869,14 +869,14 @@ dfmt c p a d = -- | Raises an 'error' with a printf-specific prefix on the -- message string. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 perror :: String -> a perror s = error $ "printf: " ++ s -- | Calls 'perror' to indicate an unknown format letter for -- a given type. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 errorBadFormat :: Char -> a errorBadFormat c = perror $ "bad formatting char " ++ show c @@ -884,15 +884,15 @@ errorShortFormat, errorMissingArgument, errorBadArgument :: a -- | Calls 'perror' to indicate that the format string ended -- early. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 errorShortFormat = perror "formatting string ended prematurely" -- | Calls 'perror' to indicate that there is a missing -- argument in the argument list. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 errorMissingArgument = perror "argument list ended prematurely" -- | Calls 'perror' to indicate that there is a type -- error or similar in the given argument. -- --- /Since: 4.7.0.0/ +-- @since 4.7.0.0 errorBadArgument = perror "bad argument" diff --git a/libraries/base/Text/Read.hs b/libraries/base/Text/Read.hs index 1d08343e2c..0e752c2bbb 100644 --- a/libraries/base/Text/Read.hs +++ b/libraries/base/Text/Read.hs @@ -62,7 +62,7 @@ reads = readsPrec minPrec -- Succeeds if there is exactly one valid result. -- A 'Left' value indicates a parse error. -- --- /Since: 4.6.0.0/ +-- @since 4.6.0.0 readEither :: Read a => String -> Either String a readEither s = case [ x | (x,"") <- readPrec_to_S read' minPrec s ] of @@ -78,7 +78,7 @@ readEither s = -- | Parse a string using the 'Read' instance. -- Succeeds if there is exactly one valid result. -- --- /Since: 4.6.0.0/ +-- @since 4.6.0.0 readMaybe :: Read a => String -> Maybe a readMaybe s = case readEither s of Left _ -> Nothing diff --git a/libraries/base/Text/Read/Lex.hs b/libraries/base/Text/Read/Lex.hs index 74cf9508e6..2e682ff7e0 100644 --- a/libraries/base/Text/Read/Lex.hs +++ b/libraries/base/Text/Read/Lex.hs @@ -63,11 +63,11 @@ data Lexeme | Punc String -- ^ Punctuation or reserved symbol, e.g. @(@, @::@ | Ident String -- ^ Haskell identifier, e.g. @foo@, @Baz@ | Symbol String -- ^ Haskell symbol, e.g. @>>@, @:%@ - | Number Number -- ^ /Since: 4.6.0.0/ + | Number Number -- ^ @since 4.6.0.0 | EOF deriving (Eq, Show) --- | /Since: 4.7.0.0/ +-- | @since 4.7.0.0 data Number = MkNumber Int -- Base Digits -- Integral part | MkDecimal Digits -- Integral part @@ -75,13 +75,13 @@ data Number = MkNumber Int -- Base (Maybe Integer) -- Exponent deriving (Eq, Show) --- | /Since: 4.5.1.0/ +-- | @since 4.5.1.0 numberToInteger :: Number -> Maybe Integer numberToInteger (MkNumber base iPart) = Just (val (fromIntegral base) 0 iPart) numberToInteger (MkDecimal iPart Nothing Nothing) = Just (val 10 0 iPart) numberToInteger _ = Nothing --- | /Since: 4.7.0.0/ +-- | @since 4.7.0.0 numberToFixed :: Integer -> Number -> Maybe (Integer, Integer) numberToFixed _ (MkNumber base iPart) = Just (val (fromIntegral base) 0 iPart, 0) numberToFixed _ (MkDecimal iPart Nothing Nothing) = Just (val 10 0 iPart, 0) @@ -109,7 +109,7 @@ numberToFixed _ _ = Nothing -- * We only worry about numbers that have an exponent. If they don't -- have an exponent then the Rational won't be much larger than the -- Number, so there is no problem --- | /Since: 4.5.1.0/ +-- | @since 4.5.1.0 numberToRangedRational :: (Int, Int) -> Number -> Maybe Rational -- Nothing = Inf numberToRangedRational (neg, pos) n@(MkDecimal iPart mFPart (Just exp)) @@ -139,7 +139,7 @@ numberToRangedRational (neg, pos) n@(MkDecimal iPart mFPart (Just exp)) else Just (numberToRational n) numberToRangedRational _ n = Just (numberToRational n) --- | /Since: 4.6.0.0/ +-- | @since 4.6.0.0 numberToRational :: Number -> Rational numberToRational (MkNumber base iPart) = val (fromIntegral base) 0 iPart % 1 numberToRational (MkDecimal iPart mFPart mExp) @@ -162,7 +162,7 @@ numberToRational (MkDecimal iPart mFPart mExp) lex :: ReadP Lexeme lex = skipSpaces >> lexToken --- | /Since: 4.7.0.0/ +-- | @since 4.7.0.0 expect :: Lexeme -> ReadP () expect lexeme = do { skipSpaces ; thing <- lexToken |