diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Haddock/Interface/AttachInstances.hs | 6 | ||||
-rw-r--r-- | src/Haddock/Utils.hs | 16 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/Haddock/Interface/AttachInstances.hs b/src/Haddock/Interface/AttachInstances.hs index 0db9f3ea..9ec3a3f2 100644 --- a/src/Haddock/Interface/AttachInstances.hs +++ b/src/Haddock/Interface/AttachInstances.hs @@ -75,7 +75,7 @@ collectInstances ifaces _ -- filterNames = Map.fromListWith (flip (++)) tyInstPairs `Map.union` Map.fromListWith (flip (++)) classInstPairs where - allInstances = concat (map ifaceInstances ifaces) + allInstances = concatMap ifaceInstances ifaces classInstPairs = [ (is_cls inst, [instanceHead inst]) | inst <- allInstances ] -- unfinished filtering of internal instances @@ -154,8 +154,8 @@ toHsType t = case t of ForAllTy v ty -> cvForAll [v] ty PredTy p -> HsPredTy (toHsPred p) where - tycon tc = HsTyVar (tyConName tc) - app tc ts = foldl (\a b -> HsAppTy (noLoc a) (noLoc b)) tc (map toHsType ts) + tycon = HsTyVar . tyConName + app tc = foldl (\a b -> HsAppTy (noLoc a) (noLoc b)) tc . map toHsType cvForAll vs (ForAllTy v ty) = cvForAll (v:vs) ty cvForAll vs ty = mkExplicitHsForAllTy (tyvarbinders vs) (noLoc []) (toLHsType ty) tyvarbinders = map (noLoc . UserTyVar . tyVarName) diff --git a/src/Haddock/Utils.hs b/src/Haddock/Utils.hs index 3bab9edf..86049d62 100644 --- a/src/Haddock/Utils.hs +++ b/src/Haddock/Utils.hs @@ -87,7 +87,7 @@ instance MonadIO IO where liftIO = id parseVerbosity :: String -> Either String Verbosity -parseVerbosity str = runReadE flagToVerbosity str +parseVerbosity = runReadE flagToVerbosity -- | Print a message to stdout, if it is not too verbose @@ -145,7 +145,7 @@ restrictCons names decls = [ L p d | L p (Just d) <- map (fmap keep) decls ] -- it's the best we can do. InfixCon _ _ -> Just d where - field_avail (ConDeclField n _ _) = (unLoc n) `elem` names + field_avail (ConDeclField n _ _) = unLoc n `elem` names field_types flds = [ t | ConDeclField _ t _ <- flds ] keep _ | otherwise = Nothing @@ -288,7 +288,7 @@ mapSnd f ((x,y):xs) = (x,f y) : mapSnd f xs mapMaybeM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) mapMaybeM _ Nothing = return Nothing -mapMaybeM f (Just a) = f a >>= return . Just +mapMaybeM f (Just a) = liftM Just (f a) escapeStr :: String -> String escapeStr = escapeURIString isUnreserved @@ -304,7 +304,7 @@ escapeURIChar p c | otherwise = '%' : myShowHex (ord c) "" where myShowHex :: Int -> ShowS - myShowHex n r = case showIntAtBase 16 (toChrHex) n r of + myShowHex n r = case showIntAtBase 16 toChrHex n r of [] -> "00" [a] -> ['0',a] cs -> cs @@ -313,7 +313,7 @@ escapeURIChar p c | otherwise = chr (ord 'A' + fromIntegral (d - 10)) escapeURIString :: (Char -> Bool) -> String -> String -escapeURIString p s = concatMap (escapeURIChar p) s +escapeURIString = concatMap . escapeURIChar isUnreserved :: Char -> Bool isUnreserved c = isAlphaNumChar c || (c `elem` "-_.~") @@ -321,7 +321,7 @@ isUnreserved c = isAlphaNumChar c || (c `elem` "-_.~") isAlphaChar, isDigitChar, isAlphaNumChar :: Char -> Bool isAlphaChar c = (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') -isDigitChar c = (c >= '0' && c <= '9') +isDigitChar c = c >= '0' && c <= '9' isAlphaNumChar c = isAlphaChar c || isDigitChar c @@ -350,7 +350,7 @@ html_xrefs = unsafePerformIO (readIORef html_xrefs_ref) replace :: Eq a => a -> a -> [a] -> [a] -replace a b xs = map (\x -> if x == a then b else x) xs +replace a b = map (\x -> if x == a then b else x) ----------------------------------------------------------------------------- @@ -406,7 +406,7 @@ nullFormatVersion :: FormatVersion nullFormatVersion = mkFormatVersion 0 mkFormatVersion :: Int -> FormatVersion -mkFormatVersion i = FormatVersion i +mkFormatVersion = FormatVersion instance Binary FormatVersion where put_ bh (FormatVersion i) = |