haddock-library 1.8.0 → 1.9.0
raw patch · 16 files changed
+217/−162 lines, 16 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGES.md +6/−0
- LICENSE +21/−18
- fixtures/examples/table-cell-strip-whitespaces.input +5/−0
- fixtures/examples/table-cell-strip-whitespaces.parsed +29/−0
- fixtures/examples/table-simple.parsed +9/−19
- fixtures/examples/table1.parsed +16/−29
- fixtures/examples/table2.parsed +10/−10
- fixtures/examples/table3.parsed +11/−11
- fixtures/examples/table4.parsed +5/−5
- fixtures/examples/table5.parsed +10/−17
- haddock-library.cabal +27/−17
- src/CompatPrelude.hs +52/−0
- src/Documentation/Haddock/Parser.hs +7/−8
- src/Documentation/Haddock/Parser/Identifier.hs +1/−27
- src/Documentation/Haddock/Parser/Monad.hs +2/−1
- src/Documentation/Haddock/Types.hs +6/−0
CHANGES.md view
@@ -1,3 +1,9 @@+## Changes in version 1.9.0++ * Fix build-time regression for `base < 4.7` (#1119)++ * Update parsing to strip whitespace from table cells (#1074)+ ## Changes in version 1.8.0 * Support inline markup in markdown-style links (#875)
LICENSE view
@@ -1,23 +1,26 @@-Copyright 2002-2010, Simon Marlow. All rights reserved.+Copyright (c) 2002-2010, Simon Marlow+All rights reserved. Redistribution and use in source and binary forms, with or without-modification, are permitted provided that the following conditions are met:+modification, are permitted provided that the following conditions are+met: -- Redistributions of source code must retain the above copyright notice,-this list of conditions and the following disclaimer.+1. Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright notice,-this list of conditions and the following disclaimer in the documentation-and/or other materials provided with the distribution.+2. Redistributions in binary form must reproduce the above copyright+ notice, this list of conditions and the following disclaimer in the+ documentation and/or other materials provided with the+ distribution. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS" AND ANY-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ fixtures/examples/table-cell-strip-whitespaces.input view
@@ -0,0 +1,5 @@++------+--------------+-------------------------------------------------++| C1 | C2 | C3 |++======+==============+=================================================++| row | 'test' | 'test table cell with .. whitepspace ' |++------+--------------+-------------------------------------------------+
+ fixtures/examples/table-cell-strip-whitespaces.parsed view
@@ -0,0 +1,29 @@+DocTable+ Table+ {tableBodyRows = [TableRow+ [TableCell+ {tableCellColspan = 1,+ tableCellContents = DocString "row",+ tableCellRowspan = 1},+ TableCell+ {tableCellColspan = 1,+ tableCellContents = DocIdentifier "test",+ tableCellRowspan = 1},+ TableCell+ {tableCellColspan = 1,+ tableCellContents = DocString+ "'test table cell with .. whitepspace '",+ tableCellRowspan = 1}]],+ tableHeaderRows = [TableRow+ [TableCell+ {tableCellColspan = 1,+ tableCellContents = DocString "C1",+ tableCellRowspan = 1},+ TableCell+ {tableCellColspan = 1,+ tableCellContents = DocString "C2",+ tableCellRowspan = 1},+ TableCell+ {tableCellColspan = 1,+ tableCellContents = DocString "C3",+ tableCellRowspan = 1}]]}
fixtures/examples/table-simple.parsed view
@@ -3,50 +3,40 @@ {tableBodyRows = [TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " 200 ",+ tableCellContents = DocString "200", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocAppend- (DocString " ")- (DocAppend- (DocMonospaced (DocString "OK"))- (DocString " ")),+ tableCellContents = DocMonospaced (DocString "OK"), tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString- " operation successful ",+ tableCellContents = DocString "operation successful", tableCellRowspan = 1}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " 204 ",+ tableCellContents = DocString "204", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocAppend- (DocString " ")- (DocAppend- (DocMonospaced (DocString "No Content"))- (DocString " ")),+ tableCellContents = DocMonospaced (DocString "No Content"), tableCellRowspan = 1}, TableCell {tableCellColspan = 1, tableCellContents = DocString- " operation successful, no body returned ",+ "operation successful, no body returned", tableCellRowspan = 1}]], tableHeaderRows = [TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " code ",+ tableCellContents = DocString "code", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " message ",+ tableCellContents = DocString "message", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString- " description ",+ tableCellContents = DocString "description", tableCellRowspan = 1}]]}
fixtures/examples/table1.parsed view
@@ -3,79 +3,66 @@ {tableBodyRows = [TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " body row 1, column 1 ",+ tableCellContents = DocString "body row 1, column 1", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 2 ",+ tableCellContents = DocString "column 2", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 3 ",+ tableCellContents = DocString "column 3", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 4 ",+ tableCellContents = DocString "column 4", tableCellRowspan = 1}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " body row 2 ",+ tableCellContents = DocString "body row 2", tableCellRowspan = 1}, TableCell {tableCellColspan = 3,- tableCellContents = DocString " Cells may span columns. ",+ tableCellContents = DocString "Cells may span columns.", tableCellRowspan = 1}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " body row 3 ",+ tableCellContents = DocString "body row 3", tableCellRowspan = 1}, TableCell {tableCellColspan = 1, tableCellContents = DocString- (concat- [" Cells may \n",- " span rows. \n",- " "]),+ (concat ["Cells may\n", "span rows.\n"]), tableCellRowspan = 2}, TableCell {tableCellColspan = 2,- tableCellContents = DocAppend- (DocString " ")- (DocAppend- (DocMathDisplay- (concat- [" \n",- " f(n) = \\sum_{i=1} \n",- " "]))- (DocString " ")),+ tableCellContents = DocMathDisplay+ (concat ["\n", "f(n) = \\sum_{i=1}\n"]), tableCellRowspan = 2}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " body row 4 ",+ tableCellContents = DocString "body row 4", tableCellRowspan = 1}]], tableHeaderRows = [TableRow [TableCell {tableCellColspan = 1, tableCellContents = DocString (concat- [" Header row, column 1 \n",- " (header rows optional) "]),+ ["Header row, column 1\n",+ "(header rows optional)"]), tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString- (concat [" Header 2 \n", " "]),+ tableCellContents = DocString "Header 2\n", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString- (concat [" Header 3 \n", " "]),+ tableCellContents = DocString "Header 3\n", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString- (concat [" Header 4 \n", " "]),+ tableCellContents = DocString "Header 4\n", tableCellRowspan = 1}]]}
fixtures/examples/table2.parsed view
@@ -3,44 +3,44 @@ {tableBodyRows = [TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " row 1, col 1 ",+ tableCellContents = DocString "row 1, col 1", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 2 ",+ tableCellContents = DocString "column 2", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 3 ",+ tableCellContents = DocString "column 3", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 4 ",+ tableCellContents = DocString "column 4", tableCellRowspan = 1}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " row 2 ",+ tableCellContents = DocString "row 2", tableCellRowspan = 1}, TableCell {tableCellColspan = 3,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " row 3 ",+ tableCellContents = DocString "row 3", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}]], tableHeaderRows = []}
fixtures/examples/table3.parsed view
@@ -3,48 +3,48 @@ {tableBodyRows = [TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " row 1, col 1 ",+ tableCellContents = DocString "row 1, col 1", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 2 ",+ tableCellContents = DocString "column 2", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 3 ",+ tableCellContents = DocString "column 3", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 4 ",+ tableCellContents = DocString "column 4", tableCellRowspan = 1}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " row 2 ",+ tableCellContents = DocString "row 2", tableCellRowspan = 1}, TableCell {tableCellColspan = 2,- tableCellContents = DocString " Use the command ``ls ",+ tableCellContents = DocString "Use the command ``ls", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " more``. ",+ tableCellContents = DocString "more``.", tableCellRowspan = 1}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " row 3 ",+ tableCellContents = DocString "row 3", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}]], tableHeaderRows = []}
fixtures/examples/table4.parsed view
@@ -8,10 +8,10 @@ {tableCellColspan = 1, tableCellContents = DocString (concat- [" outer \n",- " \n",- "-------+ \n",- " inner | "]),+ ["outer\n",+ "\n",+ "-------+\n",+ "inner |"]), tableCellRowspan = 1}]], tableHeaderRows = []}) (DocAppend@@ -21,6 +21,6 @@ {tableBodyRows = [TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " inner ",+ tableCellContents = DocString "inner", tableCellRowspan = 1}]], tableHeaderRows = []})))
fixtures/examples/table5.parsed view
@@ -4,50 +4,43 @@ [TableCell {tableCellColspan = 1, tableCellContents = DocString- (concat- [" row 2 \n",- " \n",- " \n",- " row 3 "]),+ (concat ["row 2\n", "\n", "\n", "row 3"]), tableCellRowspan = 2}, TableCell {tableCellColspan = 3, tableCellContents = DocAppend- (DocString " Use the command ")+ (DocString "Use the command ") (DocAppend (DocMonospaced (DocString "ls | more"))- (DocString- (concat- [". \n",- " "]))),+ (DocString ".\n")), tableCellRowspan = 1}], TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " ",+ tableCellContents = DocEmpty, tableCellRowspan = 1}]], tableHeaderRows = [TableRow [TableCell {tableCellColspan = 1,- tableCellContents = DocString " row 1, col 1 ",+ tableCellContents = DocString "row 1, col 1", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 2 ",+ tableCellContents = DocString "column 2", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 3 ",+ tableCellContents = DocString "column 3", tableCellRowspan = 1}, TableCell {tableCellColspan = 1,- tableCellContents = DocString " column 4 ",+ tableCellContents = DocString "column 4", tableCellRowspan = 1}]]}
haddock-library.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: haddock-library-version: 1.8.0+version: 1.9.0 synopsis: Library exposing some functionality of Haddock. description: Haddock is a documentation-generation tool for Haskell@@ -12,11 +12,22 @@ itself, see the [haddock package](https://hackage.haskell.org/package/haddock). license: BSD-2-Clause-license-files: LICENSE+license-file: LICENSE maintainer: Alec Theriault <alec.theriault@gmail.com>, Alex Biehl <alexbiehl@gmail.com>, Simon Hengel <sol@typeful.net>, Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> homepage: http://www.haskell.org/haddock/ bug-reports: https://github.com/haskell/haddock/issues category: Documentation+tested-with: GHC == 7.4.2+ , GHC == 7.6.3+ , GHC == 7.8.4+ , GHC == 7.10.3+ , GHC == 8.0.2+ , GHC == 8.2.2+ , GHC == 8.4.4+ , GHC == 8.6.5+ , GHC == 8.8.3+ , GHC == 8.10.1+ extra-source-files: CHANGES.md fixtures/examples/*.input@@ -26,7 +37,7 @@ default-language: Haskell2010 build-depends:- , base >= 4.5 && < 4.14+ , base >= 4.5 && < 4.15 , bytestring ^>= 0.9.2.1 || ^>= 0.10.0.0 , containers ^>= 0.4.2.1 || ^>= 0.5.0.0 || ^>= 0.6.0.1 , transformers ^>= 0.3.0.0 || ^>= 0.4.1.0 || ^>= 0.5.0.0@@ -49,6 +60,7 @@ Documentation.Haddock.Types other-modules:+ CompatPrelude Documentation.Haddock.Parser.Util Documentation.Haddock.Parser.Monad Documentation.Haddock.Parser.Identifier@@ -58,22 +70,20 @@ type: exitcode-stdio-1.0 main-is: Spec.hs hs-source-dirs:- test- src-- cpp-options:- -DTEST+ test+ src other-modules:- Documentation.Haddock.Doc- Documentation.Haddock.Markup- Documentation.Haddock.Parser- Documentation.Haddock.Parser.Monad- Documentation.Haddock.Parser.Util- Documentation.Haddock.Parser.UtilSpec- Documentation.Haddock.ParserSpec- Documentation.Haddock.Types- Documentation.Haddock.Parser.Identifier+ CompatPrelude+ Documentation.Haddock.Doc+ Documentation.Haddock.Markup+ Documentation.Haddock.Parser+ Documentation.Haddock.Parser.Monad+ Documentation.Haddock.Parser.Util+ Documentation.Haddock.Parser.UtilSpec+ Documentation.Haddock.ParserSpec+ Documentation.Haddock.Types+ Documentation.Haddock.Parser.Identifier build-depends: , base-compat ^>= 0.9.3 || ^>= 0.11.0
+ src/CompatPrelude.hs view
@@ -0,0 +1,52 @@+{-# LANGUAGE CPP #-}++#if !MIN_VERSION_base(4,5,0)+# error This module doesn't provide compat-shims for versions prior to base-4.5+#endif++-- | Bridge impedance mismatch of different @base@ versions back till @base-4.5@ (GHC 7.4.2)+module CompatPrelude+ ( ($>)+ , isSymbolChar+ ) where++#if MIN_VERSION_base(4,7,0)+import Data.Functor ( ($>) )+#else+import Data.Functor ( (<$) )+#endif++#if MIN_VERSION_base(4,9,0)+import Text.Read.Lex (isSymbolChar)+#else+import Data.Char (GeneralCategory(..), generalCategory)+#endif+++#if !MIN_VERSION_base(4,7,0)+infixl 4 $>++-- | Flipped version of '<$'.+--+-- @since 4.7.0.0+($>) :: Functor f => f a -> b -> f b+($>) = flip (<$)+#endif++#if !MIN_VERSION_base(4,9,0)+-- inlined from base-4.10.0.0+isSymbolChar :: Char -> Bool+isSymbolChar c = not (isPuncChar c) && case generalCategory c of+ MathSymbol -> True+ CurrencySymbol -> True+ ModifierSymbol -> True+ OtherSymbol -> True+ DashPunctuation -> True+ OtherPunctuation -> c `notElem` "'\""+ ConnectorPunctuation -> c /= '_'+ _ -> False+ where+ -- | The @special@ character class as defined in the Haskell Report.+ isPuncChar :: Char -> Bool+ isPuncChar = (`elem` (",;()[]{}`" :: String))+#endif
src/Documentation/Haddock/Parser.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ViewPatterns #-} -- |@@ -268,7 +267,7 @@ -- >>> parseString "\\(\\int_{-\\infty}^{\\infty} e^{-x^2/2} = \\sqrt{2\\pi}\\)" -- DocMathInline "\\int_{-\\infty}^{\\infty} e^{-x^2/2} = \\sqrt{2\\pi}" mathInline :: Parser (DocH mod a)-mathInline = DocMathInline . T.unpack +mathInline = DocMathInline . T.unpack <$> disallowNewline ("\\(" *> takeUntil "\\)") -- | Display math parser, surrounded by \\[ and \\].@@ -493,7 +492,7 @@ -- extract cell contents given boundaries extract :: Int -> Int -> Int -> Int -> Text extract x y x2 y2 = T.intercalate "\n"- [ T.take (x2 - x + 1) $ T.drop x $ rs !! y'+ [ T.stripEnd $ T.stripStart $ T.take (x2 - x + 1) $ T.drop x $ rs !! y' | y' <- [y .. y2] ] @@ -580,7 +579,7 @@ Right i -> (label, contents) : i -- | Drops all trailing newlines.-dropNLs :: Text -> Text +dropNLs :: Text -> Text dropNLs = T.dropWhileEnd (== '\n') -- | Main worker for 'innerList' and 'definitionList'.@@ -654,7 +653,7 @@ -- -- More precisely: skips all whitespace-only lines and returns indentation -- (horizontal space, might be empty) of that non-empty line.-takeIndent :: Parser Text +takeIndent :: Parser Text takeIndent = do indent <- takeHorizontalSpace choice' [ "\n" *> takeIndent@@ -712,14 +711,14 @@ substituteBlankLine "<BLANKLINE>" = "" substituteBlankLine xs = xs -nonEmptyLine :: Parser Text +nonEmptyLine :: Parser Text nonEmptyLine = try (mfilter (T.any (not . isSpace)) takeLine) takeLine :: Parser Text takeLine = try (takeWhile (/= '\n') <* endOfLine) endOfLine :: Parser ()-endOfLine = void "\n" <|> Parsec.eof +endOfLine = void "\n" <|> Parsec.eof -- | Property parser. --@@ -801,7 +800,7 @@ autoUrl = mkLink <$> url where url = mappend <$> choice' [ "http://", "https://", "ftp://"] <*> takeWhile1 (not . isSpace)- + mkLink :: Text -> DocH mod a mkLink s = case T.unsnoc s of Just (xs,x) | x `elem` (",.!?" :: String) -> DocHyperlink (mkHyperlink xs) `docAppend` DocString [x]
src/Documentation/Haddock/Parser/Identifier.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE ViewPatterns #-} -- |@@ -29,15 +28,8 @@ import Data.Char (isAlpha, isAlphaNum) import Control.Monad (guard)-import Data.Functor (($>))-#if MIN_VERSION_base(4,9,0)-import Text.Read.Lex (isSymbolChar)-#else-import Data.Char (GeneralCategory (..),- generalCategory)-#endif- import Data.Maybe+import CompatPrelude -- | Identifier string surrounded with namespace, opening, and closing quotes/backticks. data Identifier = Identifier !Namespace !Char String !Char@@ -56,24 +48,6 @@ s' = s{ stateInput = inp', statePos = posCl } in setParserState s' $> Identifier ns op (T.unpack ident) cl --#if !MIN_VERSION_base(4,9,0)--- inlined from base-4.10.0.0-isSymbolChar :: Char -> Bool-isSymbolChar c = not (isPuncChar c) && case generalCategory c of- MathSymbol -> True- CurrencySymbol -> True- ModifierSymbol -> True- OtherSymbol -> True- DashPunctuation -> True- OtherPunctuation -> c `notElem` "'\""- ConnectorPunctuation -> c /= '_'- _ -> False- where- -- | The @special@ character class as defined in the Haskell Report.- isPuncChar :: Char -> Bool- isPuncChar = (`elem` (",;()[]{}`" :: String))-#endif -- | Try to parse a delimited identifier off the front of the given input. --
src/Documentation/Haddock/Parser/Monad.hs view
@@ -29,7 +29,6 @@ import Data.Text ( Text ) import Control.Monad ( mfilter )-import Data.Functor ( ($>) ) import Data.String ( IsString(..) ) import Data.Bits ( Bits(..) ) import Data.Char ( ord )@@ -37,7 +36,9 @@ import Control.Applicative as App import Documentation.Haddock.Types ( Version )+ import Prelude hiding (takeWhile)+import CompatPrelude -- | The only bit of information we really care about truding along with us -- through parsing is the version attached to a @\@since@ annotation - if
src/Documentation/Haddock/Types.hs view
@@ -44,14 +44,17 @@ } deriving (Eq, Show, Functor, Foldable, Traversable) #if MIN_VERSION_base(4,8,0)+-- | __NOTE__: Only defined for @base >= 4.8.0@ instance Bifunctor MetaDoc where bimap f g (MetaDoc m d) = MetaDoc m (bimap f g d) #endif #if MIN_VERSION_base(4,10,0)+-- | __NOTE__: Only defined for @base >= 4.10.0@ instance Bifoldable MetaDoc where bifoldr f g z d = bifoldr f g z (_doc d) +-- | __NOTE__: Only defined for @base >= 4.10.0@ instance Bitraversable MetaDoc where bitraverse f g (MetaDoc m d) = MetaDoc m <$> bitraverse f g d #endif@@ -131,6 +134,7 @@ deriving (Eq, Show, Functor, Foldable, Traversable) #if MIN_VERSION_base(4,8,0)+-- | __NOTE__: Only defined for @base >= 4.8.0@ instance Bifunctor DocH where bimap _ _ DocEmpty = DocEmpty bimap f g (DocAppend docA docB) = DocAppend (bimap f g docA) (bimap f g docB)@@ -159,6 +163,7 @@ #endif #if MIN_VERSION_base(4,10,0)+-- | __NOTE__: Only defined for @base >= 4.10.0@ instance Bifoldable DocH where bifoldr f g z (DocAppend docA docB) = bifoldr f g (bifoldr f g z docA) docB bifoldr f g z (DocParagraph doc) = bifoldr f g z doc@@ -176,6 +181,7 @@ bifoldr f g z (DocTable (Table header body)) = foldr (\r acc -> foldr (flip (bifoldr f g)) acc r) (foldr (\r acc -> foldr (flip (bifoldr f g)) acc r) z body) header bifoldr _ _ z _ = z +-- | __NOTE__: Only defined for @base >= 4.10.0@ instance Bitraversable DocH where bitraverse _ _ DocEmpty = pure DocEmpty bitraverse f g (DocAppend docA docB) = DocAppend <$> bitraverse f g docA <*> bitraverse f g docB