Refactoring: Monoid on (,) does the right thing

parent daba6a47
......@@ -101,9 +101,8 @@ groupNodesByNgramsWith :: (Text -> Text)
-> Map Text (Set NodeId)
-> Map Text (Set Text, Set NodeId)
groupNodesByNgramsWith f m =
fromListWith (\a b -> (fst a <> fst b, snd a <> snd b))
$ map (\(t,ns) -> (f t, (Set.singleton t, ns)))
$ toList m
fromListWith (<>) $ map (\(t,ns) -> (f t, (Set.singleton t, ns)))
$ toList m
------------------------------------------------------------------------
getNodesByNgramsUser :: CorpusId -> NgramsType
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment