unison-codebase-sqlite-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

U.Codebase.Sqlite.LocalizeObject

Description

This module facilitates the creation of "localized" versions of objects, suitable for storage.

Localization is a stateful process in which the real database identifiers contained within an object, e.g. DbBranch, are canonicalized as local identifiers counting up from 0 in the order they are encountered in the object. The association between real and local identifier is captured in a vector, where the ith index maps local identifier i to the real identifier it corresponds to.

For example, consider a branch object that refers to terms #foo and #bar. In totally made-up syntax,

branch = {
  terms = [#foo, #bar]
}

The localized version of this branch would be

branch = {
  terms = [0, 1]
}
terms = [#foo, #bar]

where all terms, types, etc. within the branch structure refer to offsets in the associated vectors.

Synopsis

Documentation

localizeBranch :: DbBranch -> (BranchLocalIds, LocalBranch) Source #

Localize a branch object.

localizeBranchG :: forall t d p c. (Ord t, Ord d, Ord p, Ord c) => Branch' t d p c -> (BranchLocalIds' t d p c, LocalBranch) Source #

Generalized form of localizeBranch.

localizePatch :: Patch -> (PatchLocalIds, LocalPatch) Source #

Localize a patch object.

localizePatchG :: forall t h d. (Ord t, Ord h, Ord d) => Patch' t h d -> (PatchLocalIds' t h d, LocalPatch) Source #