Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
175
Issues
175
List
Board
Labels
Milestones
Merge Requests
10
Merge Requests
10
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
haskell-gargantext
Commits
2d9fa3f7
Commit
2d9fa3f7
authored
Sep 18, 2018
by
Sudhir Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ToJSON instance for Tree
parent
0cbdda21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
Main.hs
src/Gargantext/Core/Types/Main.hs
+6
-4
No files found.
src/Gargantext/Core/Types/Main.hs
View file @
2d9fa3f7
...
@@ -21,7 +21,8 @@ Portability : POSIX
...
@@ -21,7 +21,8 @@ Portability : POSIX
module
Gargantext.Core.Types.Main
where
module
Gargantext.Core.Types.Main
where
------------------------------------------------------------------------
------------------------------------------------------------------------
import
Data.Aeson
(
FromJSON
,
ToJSON
)
import
Data.Aeson
(
FromJSON
,
ToJSON
,
toJSON
)
import
Data.Aeson
as
A
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Eq
(
Eq
())
import
Data.Eq
(
Eq
())
import
Data.Monoid
((
<>
))
import
Data.Monoid
((
<>
))
...
@@ -136,7 +137,10 @@ type Offset = Int
...
@@ -136,7 +137,10 @@ type Offset = Int
data
Tree
a
=
NodeT
a
[
Tree
a
]
data
Tree
a
=
NodeT
a
[
Tree
a
]
deriving
(
Show
,
Read
,
Eq
,
Generic
)
deriving
(
Show
,
Read
,
Eq
,
Generic
)
instance
ToJSON
(
Tree
NodeTree
)
instance
ToJSON
(
Tree
NodeTree
)
where
toJSON
(
NodeT
node
nodes
)
=
object
[
"node"
A
..=
toJSON
node
,
"nodes"
A
..=
toJSON
nodes
]
instance
FromJSON
(
Tree
NodeTree
)
instance
FromJSON
(
Tree
NodeTree
)
instance
ToSchema
NodeTree
instance
ToSchema
NodeTree
...
@@ -148,5 +152,3 @@ instance Arbitrary (Tree NodeTree) where
...
@@ -148,5 +152,3 @@ instance Arbitrary (Tree NodeTree) where
-- same as Data.Tree
-- same as Data.Tree
leafT
::
a
->
Tree
a
leafT
::
a
->
Tree
a
leafT
x
=
NodeT
x
[]
leafT
x
=
NodeT
x
[]
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