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
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
Grégoire Locqueville
purescript-gargantext
Commits
066514fd
Unverified
Commit
066514fd
authored
Mar 01, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NGRAMS-REPO]: uniformize TermList constructors
parent
9e778543
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
Types.purs
src/Gargantext/Types.purs
+14
-13
No files found.
src/Gargantext/Types.purs
View file @
066514fd
...
...
@@ -26,21 +26,22 @@ termSizes = [ { desc: "All types", mval: Nothing }
]
data TermList = GraphTerm | StopTerm | CandidateTerm
-- TODO use generic JSON instance
derive instance eqTermList :: Eq TermList
instance encodeJsonTermList :: EncodeJson TermList where
encodeJson GraphTerm = encodeJson "Graph
List
"
encodeJson StopTerm = encodeJson "Stop
List
"
encodeJson CandidateTerm = encodeJson "Candidate
List
"
encodeJson GraphTerm = encodeJson "Graph
Term
"
encodeJson StopTerm = encodeJson "Stop
Term
"
encodeJson CandidateTerm = encodeJson "Candidate
Term
"
instance decodeJsonTermList :: DecodeJson TermList where
decodeJson json = do
s <- decodeJson json
case s of
"Graph
List
" -> pure GraphTerm
"Stop
List
" -> pure StopTerm
"Candidate
List
" -> pure CandidateTerm
"Graph
Term
" -> pure GraphTerm
"Stop
Term
" -> pure StopTerm
"Candidate
Term
" -> pure CandidateTerm
_ -> Left "Unexpected list name"
type ListTypeId = Int
...
...
@@ -51,14 +52,14 @@ listTypeId StopTerm = 2
listTypeId CandidateTerm = 3
instance showTermList :: Show TermList where
show GraphTerm = "Graph"
show StopTerm = "Stop"
show CandidateTerm = "Candidate"
show GraphTerm = "Graph
Term
"
show StopTerm = "Stop
Term
"
show CandidateTerm = "Candidate
Term
"
readTermList :: String -> Maybe TermList
readTermList "Graph" = Just GraphTerm
readTermList "Stop" = Just StopTerm
readTermList "Candidate" = Just CandidateTerm
readTermList "Graph
Term
" = Just GraphTerm
readTermList "Stop
Term
" = Just StopTerm
readTermList "Candidate
Term
" = Just CandidateTerm
readTermList _ = Nothing
termLists :: Array { desc :: String, mval :: Maybe TermList }
...
...
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