Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
128
Issues
128
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
c2dec023
Commit
c2dec023
authored
Oct 01, 2020
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HACK: reRootChildren to avoid infinite recursions
parent
0c203acc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+8
-4
No files found.
src/Gargantext/Components/NgramsTable/Core.purs
View file @
c2dec023
...
...
@@ -758,18 +758,22 @@ type RootParent = { root :: NgramsTerm, parent :: NgramsTerm }
type ReParent a = forall m. MonadState NgramsTable m => a -> m Unit
reRootChildren :: NgramsTerm -> ReParent NgramsTerm
reRootChildren root ngram = do
reRootMaxDepth :: Int
reRootMaxDepth = 100 -- TODO: this is a hack
reRootChildren :: Int -> NgramsTerm -> ReParent NgramsTerm
reRootChildren 0 _ _ = pure unit -- TODO: this is a hack
reRootChildren max_depth root ngram = do
nre <- use (at ngram)
traverseOf_ (_Just <<< _NgramsRepoElement <<< _children <<< folded) (\child -> do
at child <<< _Just <<< _NgramsRepoElement <<< _root ?= root
reRootChildren root child) nre
reRootChildren
(max_depth - 1)
root child) nre
reParent :: Maybe RootParent -> ReParent NgramsTerm
reParent mrp child = do
at child <<< _Just <<< _NgramsRepoElement %= ((_parent .~ (view _parent <$> mrp)) <<<
(_root .~ (view _root <$> mrp)))
reRootChildren (fromMaybe child (mrp ^? _Just <<< _root)) child
reRootChildren
reRootMaxDepth
(fromMaybe child (mrp ^? _Just <<< _root)) child
-- reParentNgramsPatch :: NgramsTerm -> ReParent NgramsPatch
-- ^ GHC would have accepted this type. Here reParentNgramsPatch checks but
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment