Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
crawlers
hal
Commits
9acf7ad9
Commit
9acf7ad9
authored
Nov 12, 2019
by
Mudada
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new type for struct's call
parent
000e2322
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
Struct.hs
src/HAL/Doc/Struct.hs
+35
-0
No files found.
src/HAL/Doc/Struct.hs
0 → 100644
View file @
9acf7ad9
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
module
HAL.Doc.Struct
where
import
GHC.Generics
import
Data.Aeson
import
Data.Default
import
Data.Text
(
pack
,
Text
)
import
Control.Applicative
((
<|>
))
import
qualified
Control.Lens
as
L
import
Servant.API
(
ToHttpApiData
(
..
))
data
Struct
=
Struct
{
_struct_docid
::
Int
,
_struct_label
::
Text
,
_struct_parent_docid
::
[
Int
]
}
deriving
(
Show
,
Generic
)
L
.
makeLenses
''
S
truct
instance
Default
Struct
where
def
=
Struct
def
""
def
instance
FromJSON
Struct
where
parseJSON
(
Object
o
)
=
Struct
<$>
(
o
.:
"docid"
)
<*>
(
o
.:
"label_s"
)
<*>
(
o
.:
"parentDocid_i"
<|>
return
[]
)
instance
ToHttpApiData
Struct
where
toUrlPiece
_
=
"docid,label_s,parentDocid_i"
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