diff options
| author | Herbert Valerio Riedel <hvr@gnu.org> | 2018-03-08 10:39:37 +0100 | 
|---|---|---|
| committer | Alexander Biehl <alexbiehl@gmail.com> | 2018-03-10 18:25:57 +0100 | 
| commit | 333aab8827b4a98ed68108751cf930012f79567c (patch) | |
| tree | 408c4e1f066b68596ebddb66e6afd8e2a0e51bc1 /haddock-library/src/Documentation | |
| parent | 85d88f826e2e9c3aaf643b7e29c63db1fccd8c57 (diff) | |
Restore backward-compat with base-4.5 through base-4.8
Diffstat (limited to 'haddock-library/src/Documentation')
| -rw-r--r-- | haddock-library/src/Documentation/Haddock/Parser.hs | 29 | ||||
| -rw-r--r-- | haddock-library/src/Documentation/Haddock/Types.hs | 1 | 
2 files changed, 28 insertions, 2 deletions
| diff --git a/haddock-library/src/Documentation/Haddock/Parser.hs b/haddock-library/src/Documentation/Haddock/Parser.hs index 82515ab4..250b7f0d 100644 --- a/haddock-library/src/Documentation/Haddock/Parser.hs +++ b/haddock-library/src/Documentation/Haddock/Parser.hs @@ -1,5 +1,6 @@ +{-# LANGUAGE CPP               #-}  {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE ViewPatterns #-} +{-# LANGUAGE ViewPatterns      #-}  -- |  -- Module      :  Documentation.Haddock.Parser  -- Copyright   :  (c) Mateusz Kowalczyk 2013-2014, @@ -35,11 +36,35 @@ import           Documentation.Haddock.Types  import           Documentation.Haddock.Utf8  import           Prelude hiding (takeWhile)  import qualified Prelude as P -import           Text.Read.Lex (isSymbolChar) + +#if MIN_VERSION_base(4,9,0) +import           Text.Read.Lex                      (isSymbolChar) +#else +import           Data.Char                          (GeneralCategory (..), +                                                     generalCategory) +#endif  -- $setup  -- >>> :set -XOverloadedStrings +#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     -> not (c `elem` ("'\"" :: String)) +    ConnectorPunctuation -> c /= '_' +    _                    -> False +  where +    -- | The @special@ character class as defined in the Haskell Report. +    isPuncChar :: Char -> Bool +    isPuncChar = (`elem` (",;()[]{}`" :: String)) +#endif +  -- | Identifier string surrounded with opening and closing quotes/backticks.  type Identifier = (Char, String, Char) diff --git a/haddock-library/src/Documentation/Haddock/Types.hs b/haddock-library/src/Documentation/Haddock/Types.hs index 96653864..209f26e8 100644 --- a/haddock-library/src/Documentation/Haddock/Types.hs +++ b/haddock-library/src/Documentation/Haddock/Types.hs @@ -15,6 +15,7 @@  module Documentation.Haddock.Types where  #if !MIN_VERSION_base(4,8,0) +import Control.Applicative  import Data.Foldable  import Data.Traversable  #endif | 
