From d77c614e18f5f2865a74f7071a1f8c2d8087f88f Mon Sep 17 00:00:00 2001 From: Neil Mitchell Date: Sat, 14 Jun 2008 10:56:50 +0000 Subject: Simplify the newtype/data outputting in Hoogle, as haddock does it automatically --- src/Haddock/Backends/Hoogle.hs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Haddock/Backends/Hoogle.hs b/src/Haddock/Backends/Hoogle.hs index 91f4225d..635cc9bf 100644 --- a/src/Haddock/Backends/Hoogle.hs +++ b/src/Haddock/Backends/Hoogle.hs @@ -86,12 +86,8 @@ ppData :: TyClDecl Name -> [String] ppData x = showData x{tcdCons=[],tcdDerivs=Nothing} : concatMap (ppCtor x . unL) (tcdCons x) where - showData = unwords . f . words . out - - -- note: tcdND always seems to not match NewType (BUG?) - f ("data":xs) | tcdND x == NewType = f ("newtype":xs) - f xs | ["="] `isSuffixOf` xs = init xs - f xs = xs + -- GHC gives out "data Bar =", we want to delete the equals + showData = reverse . dropWhile (`elem` " =") . reverse . out ppCtor :: TyClDecl Name -> ConDecl Name -> [String] -- cgit v1.2.3