]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Types.hs
[CLEAN] replace NgramsTerms with Text to avoid ambiguity with Types of Ngrams
[gargantext.git] / src / Gargantext / Database / Types.hs
1 {-|
2 Module : Gargantext.Database.Types
3 Description : Specific Types to manage core Gargantext type with database
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9
10 -}
11
12 {-# LANGUAGE TemplateHaskell #-}
13
14 module Gargantext.Database.Types
15 where
16
17 import Gargantext.Prelude
18 import Gargantext.Database.Schema.Prelude
19 import qualified Database.PostgreSQL.Simple as PGS
20
21
22 -- | Index memory of any type in Gargantext
23 type Index = Int
24 data Indexed a =
25 Indexed { _index :: Index
26 , _unIndex :: a
27 }
28 deriving (Show, Generic, Eq, Ord)
29
30 makeLenses ''Indexed
31
32 instance (FromField a) => PGS.FromRow (Indexed a) where
33 fromRow = Indexed <$> field <*> field
34