aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockUtil.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/HaddockUtil.hs')
-rw-r--r--src/HaddockUtil.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/HaddockUtil.hs b/src/HaddockUtil.hs
index 4d67f0d7..1d962c82 100644
--- a/src/HaddockUtil.hs
+++ b/src/HaddockUtil.hs
@@ -20,7 +20,7 @@ module HaddockUtil (
-- * Miscellaneous utilities
getProgramName, bye, die, dieMsg, noDieMsg, mapSnd, mapMaybeM, escapeStr,
- nameOccString, moduleString, mkModuleNoPkg,
+ isConSym, isVarSym, nameOccString, moduleString, mkModuleNoPkg,
-- * HTML cross reference mapping
html_xrefs_ref,
@@ -46,7 +46,7 @@ import Module
import PackageConfig ( stringToPackageId )
import Control.Monad ( liftM, MonadPlus(..) )
-import Data.Char ( isAlpha, isSpace, toUpper, ord )
+import Data.Char
import Data.IORef ( IORef, newIORef, readIORef )
import Data.List ( intersect, isSuffixOf, intersperse )
import Data.Maybe ( maybeToList, fromMaybe, isJust, fromJust )
@@ -231,6 +231,11 @@ escapeStr = flip escapeString unreserved
escapeStr = escapeURIString isUnreserved
#endif
+-- there should be a better way to check this using the GHC API
+isConSym n = head (nameOccString n) == ':'
+isVarSym n = fstChar /= '_' && not (isConSym n) && (not . isLetter) fstChar
+ where fstChar = head (nameOccString n)
+
nameOccString = occNameString . nameOccName
moduleString :: Module -> String