Commit 03915048 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'applypatchmap-perfs' of...

Merge branch 'applypatchmap-perfs' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents 23bce02c 3d8c5286
{ {
"name": "Gargantext", "name": "Gargantext",
"version": "0.0.2.2", "version": "0.0.2.2.1",
"scripts": { "scripts": {
"rebase-set": "spago package-set-upgrade && spago psc-package-insdhall", "rebase-set": "spago package-set-upgrade && spago psc-package-insdhall",
"rebuild-set": "spago psc-package-insdhall", "rebuild-set": "spago psc-package-insdhall",
......
...@@ -744,11 +744,17 @@ mergeMap f m1 m2 = Map.mapMaybeWithKey f (Map.unionWith g (This <$> m1) (That <$ ...@@ -744,11 +744,17 @@ mergeMap f m1 m2 = Map.mapMaybeWithKey f (Map.unionWith g (This <$> m1) (That <$
g x _ = x -- impossible g x _ = x -- impossible
applyPatchMap :: forall k p v. Ord k => (p -> Maybe v -> Maybe v) -> PatchMap k p -> Map k v -> Map k v applyPatchMap :: forall k p v. Ord k => (p -> Maybe v -> Maybe v) -> PatchMap k p -> Map k v -> Map k v
{-
applyPatchMap applyPatchValue (PatchMap pm) m = mergeMap f pm m applyPatchMap applyPatchValue (PatchMap pm) m = mergeMap f pm m
where where
f _ (This pv) = applyPatchValue pv Nothing f _ (This pv) = applyPatchValue pv Nothing
f _ (That v) = Just v f _ (That v) = Just v
f _ (Both pv v) = applyPatchValue pv (Just v) f _ (Both pv v) = applyPatchValue pv (Just v)
-}
applyPatchMap applyPatchValue (PatchMap pm) m =
foldl go m (Map.toUnfoldable pm :: List (Tuple k p))
where
go m (Tuple k pv) = Map.alter (applyPatchValue pv) k m
type NgramsPatches = PatchMap NgramsTerm NgramsPatch type NgramsPatches = PatchMap NgramsTerm NgramsPatch
type VersionedNgramsPatches = Versioned NgramsPatches type VersionedNgramsPatches = Versioned NgramsPatches
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment