aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockUtil.hs
diff options
context:
space:
mode:
authordavve <davve@dtek.chalmers.se>2007-02-04 17:37:08 +0000
committerdavve <davve@dtek.chalmers.se>2007-02-04 17:37:08 +0000
commit357bc99bb13c68ffb6e1b10f6739fe5f753b9fe3 (patch)
tree4a5d4715f79bb4ffd86d370b3d404ca9c567acd4 /src/HaddockUtil.hs
parente93d48aff9e9b13f393e168e01b10de0bfd290f2 (diff)
Insert spaces around infix function names
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