]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Core/Text/List/Merge.hs
[FIX] HashMap lacking functions in main lib
[gargantext.git] / src / Gargantext / Core / Text / List / Merge.hs
1 {-|
2 Module : Gargantext.Core.Text.List.Merge
3 Description :
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 {-# LANGUAGE ConstraintKinds #-}
14 {-# LANGUAGE TypeFamilies #-}
15 {-# LANGUAGE FunctionalDependencies #-}
16 {-# LANGUAGE InstanceSigs #-}
17
18 module Gargantext.Core.Text.List.Merge
19 where
20
21 import Control.Lens (view)
22 import Data.Map (Map)
23 import Data.Text (Text)
24 import Gargantext.API.Ngrams
25 import Gargantext.API.Ngrams.Types
26 import Gargantext.Prelude
27 import Data.Map.Strict.Patch hiding (PatchMap)
28
29 type List = Map NgramsTerm NgramsRepoElement
30 type Patch = PatchMap NgramsTerm (Replace (Maybe NgramsRepoElement))
31
32 -- Question: which version of Patching increment is using the FrontEnd ?
33 diffList :: Versioned List -> Versioned List -> Versioned Patch
34 diffList l1 l2 = Versioned (1 + view v_version l1)
35 (diff (view v_data l1) (view v_data l2))
36
37 -- | TODO
38 {-
39 commit :: ListId -> NgramsType -> Versioned Patch -> List -> List
40 commit = undefined
41 -}