From e5bd27b5edf533054513871dc475a54a8b1bee23 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Mon, 24 Feb 2014 22:01:11 +0000 Subject: Change rendering of duplicate record field docs See Haddock Trac #195. We now change this behaviour to only rendering the documentation attached to the first instance of a duplicate field. Perhaps we could improve this by rendering the first instance that has documentation attached to it but for now, we'll stick with this. --- src/Haddock/Interface/Create.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Haddock/Interface/Create.hs b/src/Haddock/Interface/Create.hs index cf5a3451..f3658a12 100644 --- a/src/Haddock/Interface/Create.hs +++ b/src/Haddock/Interface/Create.hs @@ -31,6 +31,7 @@ import Data.Ord import Control.Applicative import Control.DeepSeq import Control.Monad +import Data.Function (on) import qualified Data.Foldable as F import qualified Data.Traversable as T @@ -255,7 +256,7 @@ mkMaps :: DynFlags -> ErrMsgM Maps mkMaps dflags gre instances decls = do (a, b, c, d) <- unzip4 <$> mapM mappings decls - return (f a, f b, f c, f d, instanceMap) + return (f $ map (nubBy ((==) `on` fst)) a , f b, f c, f d, instanceMap) where f :: (Ord a, Monoid b) => [[(a, b)]] -> Map a b f = M.fromListWith (<>) . concat -- cgit v1.2.3