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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
2f672573
Commit
2f672573
authored
Jan 06, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Type] Indexed generic and polymorphic type to save database id with core garg types.
parent
55072e33
Pipeline
#1329
failed with stage
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
8 deletions
+35
-8
Types.hs
src/Gargantext/Core/Types.hs
+1
-2
Ngrams.hs
src/Gargantext/Database/Schema/Ngrams.hs
+0
-6
Types.hs
src/Gargantext/Database/Types.hs
+34
-0
No files found.
src/Gargantext/Core/Types.hs
View file @
2f672573
...
@@ -157,14 +157,13 @@ instance (Typeable a, ToSchema a) => ToSchema (TableResult a) where
...
@@ -157,14 +157,13 @@ instance (Typeable a, ToSchema a) => ToSchema (TableResult a) where
instance
Arbitrary
a
=>
Arbitrary
(
TableResult
a
)
where
instance
Arbitrary
a
=>
Arbitrary
(
TableResult
a
)
where
arbitrary
=
TableResult
<$>
arbitrary
<*>
arbitrary
arbitrary
=
TableResult
<$>
arbitrary
<*>
arbitrary
----------------------------------------------------------------------------
-- TO BE removed
-- TO BE removed
data
TODO
=
TODO
data
TODO
=
TODO
deriving
(
Generic
)
deriving
(
Generic
)
instance
ToSchema
TODO
where
instance
ToSchema
TODO
where
instance
ToParamSchema
TODO
where
instance
ToParamSchema
TODO
where
----------------------------------------------------------------------------
----------------------------------------------------------------------------
src/Gargantext/Database/Schema/Ngrams.hs
View file @
2f672573
...
@@ -198,11 +198,5 @@ indexNgramsT = fmap . indexNgramsWith . withMap
...
@@ -198,11 +198,5 @@ indexNgramsT = fmap . indexNgramsWith . withMap
indexNgrams
::
Map
NgramsTerms
NgramsId
->
Ngrams
->
(
NgramsIndexed
Ngrams
)
indexNgrams
::
Map
NgramsTerms
NgramsId
->
Ngrams
->
(
NgramsIndexed
Ngrams
)
indexNgrams
=
indexNgramsWith
.
withMap
indexNgrams
=
indexNgramsWith
.
withMap
{-
-- NP: not sure we need it anymore
indexNgramsTWith :: (NgramsTerms -> NgramsId) -> NgramsT Ngrams -> NgramsT (NgramsIndexed
indexNgramsTWith = fmap . indexNgramsWith
-}
indexNgramsWith
::
(
NgramsTerms
->
NgramsId
)
->
Ngrams
->
NgramsIndexed
Ngrams
indexNgramsWith
::
(
NgramsTerms
->
NgramsId
)
->
Ngrams
->
NgramsIndexed
Ngrams
indexNgramsWith
f
n
=
NgramsIndexed
n
(
f
$
_ngramsTerms
n
)
indexNgramsWith
f
n
=
NgramsIndexed
n
(
f
$
_ngramsTerms
n
)
src/Gargantext/Database/Types.hs
0 → 100644
View file @
2f672573
{-|
Module : Gargantext.Database.Types
Description : Specific Types to manage core Gargantext type with database
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.Database.Types
where
import
Gargantext.Prelude
import
Gargantext.Database.Schema.Prelude
import
qualified
Database.PostgreSQL.Simple
as
PGS
-- | Index memory of any type in Gargantext
type
Index
=
Int
data
Indexed
a
=
Indexed
{
_unIndex
::
a
,
_index
::
Index
}
deriving
(
Show
,
Generic
,
Eq
,
Ord
)
makeLenses
''
I
ndexed
instance
(
FromField
a
)
=>
PGS
.
FromRow
(
Indexed
a
)
where
fromRow
=
Indexed
<$>
field
<*>
field
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