]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Core/Text/List/Merge.hs
[VERSION] +1 to 0.0.5.6.7
[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 Gargantext.API.Ngrams
24 import Gargantext.API.Ngrams.Types
25 import Gargantext.Prelude
26 import Data.Map.Strict.Patch hiding (PatchMap)
27
28 type List = Map NgramsTerm NgramsRepoElement
29 type Patch = PatchMap NgramsTerm (Replace (Maybe NgramsRepoElement))
30
31 -- Question: which version of Patching increment is using the FrontEnd ?
32 diffList :: Versioned List -> Versioned List -> Versioned Patch
33 diffList l1 l2 = Versioned (1 + view v_version l1)
34 (diff (view v_data l1) (view v_data l2))
35
36 -- | TODO
37 {-
38 commit :: ListId -> NgramsType -> Versioned Patch -> List -> List
39 commit = undefined
40 -}