Refactoring: Monoid on (,) does the right thing

parent daba6a47
...@@ -101,8 +101,7 @@ groupNodesByNgramsWith :: (Text -> Text) ...@@ -101,8 +101,7 @@ groupNodesByNgramsWith :: (Text -> Text)
-> Map Text (Set NodeId) -> Map Text (Set NodeId)
-> Map Text (Set Text, Set NodeId) -> Map Text (Set Text, Set NodeId)
groupNodesByNgramsWith f m = groupNodesByNgramsWith f m =
fromListWith (\a b -> (fst a <> fst b, snd a <> snd b)) fromListWith (<>) $ map (\(t,ns) -> (f t, (Set.singleton t, ns)))
$ map (\(t,ns) -> (f t, (Set.singleton t, ns)))
$ toList m $ toList m
------------------------------------------------------------------------ ------------------------------------------------------------------------
......
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