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)
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)
29 type List = Map NgramsTerm NgramsRepoElement
30 type Patch = PatchMap NgramsTerm (Replace (Maybe NgramsRepoElement))
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))
39 commit :: ListId -> NgramsType -> Versioned Patch -> List -> List