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
147
Issues
147
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
a78d405e
Commit
a78d405e
authored
Jan 08, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NewType] FromField fix.
parent
a759d5d6
Pipeline
#112
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
Node.hs
src/Gargantext/Database/Types/Node.hs
+6
-2
No files found.
src/Gargantext/Database/Types/Node.hs
View file @
a78d405e
...
...
@@ -31,6 +31,7 @@ import GHC.Generics (Generic)
import
Control.Lens
hiding
(
elements
)
import
qualified
Control.Lens
as
L
import
Control.Applicative
((
<*>
))
import
Control.Monad
(
mzero
)
import
Data.Aeson
import
Data.Aeson.Types
(
emptyObject
)
...
...
@@ -57,7 +58,7 @@ import Test.QuickCheck (elements)
import
Gargantext.Prelude
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
import
Gargantext.Database.Utils
--
import Gargantext.Database.Utils
------------------------------------------------------------------------
newtype
NodeId
=
NodeId
Int
deriving
(
Show
,
Read
,
Generic
,
Num
,
Eq
,
Ord
,
Enum
)
...
...
@@ -66,7 +67,10 @@ instance ToField NodeId where
toField
(
NodeId
n
)
=
toField
n
instance
FromField
NodeId
where
fromField
=
fromField'
fromField
field
mdata
=
do
n
<-
fromField
field
mdata
if
(
n
::
Int
)
>
0
then
return
$
NodeId
n
else
mzero
instance
ToJSON
NodeId
instance
FromJSON
NodeId
...
...
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