]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Database/Flow/Types.hs
changement du seuil
[gargantext.git] / src / Gargantext / Database / Flow / Types.hs
1 {-|
2 Module : Gargantext.Database.Flow.Types
3 Description : Types for Flow
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 {-# OPTIONS_GHC -fno-warn-orphans #-}
13
14 {-# LANGUAGE ConstraintKinds #-}
15 {-# LANGUAGE RankNTypes #-}
16 {-# LANGUAGE ConstrainedClassMethods #-}
17 {-# LANGUAGE ConstraintKinds #-}
18 {-# LANGUAGE DeriveGeneric #-}
19 {-# LANGUAGE FlexibleContexts #-}
20 {-# LANGUAGE InstanceSigs #-}
21 {-# LANGUAGE NoImplicitPrelude #-}
22 {-# LANGUAGE OverloadedStrings #-}
23
24 module Gargantext.Database.Flow.Types
25 where
26
27 import Data.Map (Map)
28 import Gargantext.Prelude
29 import Gargantext.Core.Flow.Types
30 import Gargantext.API.Ngrams (HasRepoVar, RepoCmdM)
31 import Gargantext.Database.Schema.Ngrams (Ngrams(..), NgramsType(..))
32 import Gargantext.Database.Types.Node (NodeId)
33 import Gargantext.Database.Schema.Node (HasNodeError)
34 import Gargantext.Database.Utils (CmdM)
35
36 type FlowCmdM env err m =
37 ( CmdM env err m
38 , RepoCmdM env err m
39 , HasNodeError err
40 , HasRepoVar env
41 )
42
43 data DocumentIdWithNgrams a = DocumentIdWithNgrams
44 { documentWithId :: !(DocumentWithId a)
45 , document_ngrams :: !(Map Ngrams (Map NgramsType Int))
46 } deriving (Show)
47
48 data DocumentWithId a = DocumentWithId
49 { documentId :: !NodeId
50 , documentData :: !a
51 } deriving (Show)
52
53 instance HasText a => HasText (DocumentWithId a)
54 where
55 hasText (DocumentWithId _ a) = hasText a
56
57