2 Module : Gargantext.Core.Text.List.Merge
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# LANGUAGE TemplateHaskell #-}
13 {-# LANGUAGE ConstraintKinds #-}
14 {-# LANGUAGE TypeFamilies #-}
15 {-# LANGUAGE FunctionalDependencies #-}
16 {-# LANGUAGE InstanceSigs #-}
18 module Gargantext.Core.Text.List.Merge
21 import Control.Lens (view)
22 import Data.Map.Strict (Map)
23 import Gargantext.API.Ngrams
24 import Gargantext.API.Ngrams.Types
25 import Gargantext.Prelude
26 import Data.Map.Strict.Patch hiding (PatchMap)
28 type List = Map NgramsTerm NgramsRepoElement
29 type Patch = PatchMap NgramsTerm (Replace (Maybe NgramsRepoElement))
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))
38 commit :: ListId -> NgramsType -> Versioned Patch -> List -> List