aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Interface
diff options
context:
space:
mode:
authorMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-02-24 22:01:11 +0000
committerMateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>2014-02-27 03:00:33 +0000
commite5bd27b5edf533054513871dc475a54a8b1bee23 (patch)
tree5f2d9a9c3a0756854b75498c6f430a1a82267fd7 /src/Haddock/Interface
parentdaa0ae5ba1acdee031cd72fc6690fe60a6710c20 (diff)
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.
Diffstat (limited to 'src/Haddock/Interface')
-rw-r--r--src/Haddock/Interface/Create.hs3
1 files changed, 2 insertions, 1 deletions
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