Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
c9b9388a
Commit
c9b9388a
authored
Dec 11, 2020
by
Przemyslaw Kaminski
Committed by
Alexandre Delanoë
Dec 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tree] refactor "root" variable name
parent
8c14d95e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
Tree.hs
src/Gargantext/Database/Query/Tree.hs
+16
-16
No files found.
src/Gargantext/Database/Query/Tree.hs
View file @
c9b9388a
...
...
@@ -190,24 +190,24 @@ toTree :: ( MonadError e m
->
m
(
Tree
NodeTree
)
toTree
m
=
case
lookup
Nothing
m
of
Just
[
n
]
->
pure
$
toTree'
m
n
Nothing
->
treeError
NoRoot
Just
[]
->
treeError
EmptyRoot
Just
_r
->
treeError
TooManyRoots
Just
[
root
]
->
pure
$
toTree'
m
root
Nothing
->
treeError
NoRoot
Just
[]
->
treeError
EmptyRoot
Just
_r
->
treeError
TooManyRoots
where
toTree'
::
Map
(
Maybe
ParentId
)
[
DbTreeNode
]
->
DbTreeNode
->
Tree
NodeTree
toTree'
m'
n
=
TreeN
(
toNodeTree
n
)
$
-- | Lines below are equivalent computationally but not semantically
-- m' ^.. at (Just $ _dt_nodeId n
) . _Just . each . to (toTree' m')
toListOf
(
at
(
Just
$
_dt_nodeId
n
)
.
_Just
.
each
.
to
(
toTree'
m'
))
m'
toNodeTree
::
DbTreeNode
->
NodeTree
toNodeTree
(
DbTreeNode
nId
tId
_
n
)
=
NodeTree
n
(
fromNodeTypeId
tId
)
nId
toTree'
::
Map
(
Maybe
ParentId
)
[
DbTreeNode
]
->
DbTreeNode
->
Tree
NodeTree
toTree'
m'
root
=
TreeN
(
toNodeTree
root
)
$
-- | Lines below are equivalent computationally but not semantically
-- m' ^.. at (Just $ _dt_nodeId root
) . _Just . each . to (toTree' m')
toListOf
(
at
(
Just
$
_dt_nodeId
root
)
.
_Just
.
each
.
to
(
toTree'
m'
))
m'
toNodeTree
::
DbTreeNode
->
NodeTree
toNodeTree
(
DbTreeNode
nId
tId
_
n
)
=
NodeTree
n
(
fromNodeTypeId
tId
)
nId
------------------------------------------------------------------------
toTreeParent
::
[
DbTreeNode
]
...
...
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