From c624d176f84335a3221708a9207f8197de88045d Mon Sep 17 00:00:00 2001 From: mzheng <1363-mzheng@users.noreply.gitlab.iscpif.fr> Date: Thu, 29 Aug 2024 11:37:07 +0200 Subject: [PATCH] formating addGroup --- .../Core/Text/List/Group/WithScores.hs | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/Gargantext/Core/Text/List/Group/WithScores.hs b/src/Gargantext/Core/Text/List/Group/WithScores.hs index fdf3af85..040d74e5 100644 --- a/src/Gargantext/Core/Text/List/Group/WithScores.hs +++ b/src/Gargantext/Core/Text/List/Group/WithScores.hs @@ -131,23 +131,26 @@ toGroupedTreeInstitutes'' m notEmpty institutesTree -> Parent -> GroupedTreeScores score -> GroupedTreeScores score - addGroup institutesTree' m' k v = - over gts'_children ( toGroupedTree'' m' - . case HashMap.lookup (unNgramsTerm k) institutesTree' of - Nothing -> HashMap.union ( fromMaybe mempty - $ HashMap.lookup (Just k) m' - ) - Just children -> HashMap.union (foldl (\acc child -> HashMap.union acc $ - HashMap.singleton - (NgramsTerm child) - GroupedTreeScores - { _gts'_score= _gts'_score v - , _gts'_listType= _gts'_listType v - , _gts'_children= HashMap.empty - }) HashMap.empty children - ) - . HashMap.union ( fromMaybe mempty - $ HashMap.lookup (Just k) m' - ) - ) - v \ No newline at end of file + addGroup institutesTree' dict' key val = + over gts'_children + ( toGroupedTree'' dict' + . case HashMap.lookup (unNgramsTerm key) institutesTree' of + Nothing -> HashMap.union ( fromMaybe mempty + $ HashMap.lookup (Just key) dict' + ) + Just children + -> HashMap.union + (foldl (\acc child + -> HashMap.union acc + $ HashMap.singleton (NgramsTerm child) GroupedTreeScores + { _gts'_score= _gts'_score val + , _gts'_listType= _gts'_listType val + , _gts'_children= HashMap.empty + } + ) HashMap.empty children + ) + . HashMap.union ( fromMaybe mempty + $ HashMap.lookup (Just key) dict' + ) + ) + val \ No newline at end of file -- 2.21.0