mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-10 11:15:08 +03:00
get code compiling and do a wee bit of work on TempEntity
This commit is contained in:
parent
19f917beea
commit
278ed8b232
@ -5,10 +5,12 @@ module U.Codebase.Sqlite.Decl.Format where
|
||||
import Data.Vector (Vector)
|
||||
import U.Codebase.Decl (DeclR)
|
||||
import U.Codebase.Reference (Reference')
|
||||
import U.Codebase.Sqlite.LocalIds (LocalDefnId, LocalIds, LocalTextId)
|
||||
import U.Codebase.Sqlite.DbId (ObjectId, TextId)
|
||||
import U.Codebase.Sqlite.LocalIds (LocalDefnId, LocalIds', LocalTextId)
|
||||
import U.Codebase.Sqlite.Symbol (Symbol)
|
||||
import qualified U.Codebase.Type as Type
|
||||
import qualified U.Core.ABT as ABT
|
||||
import Unison.Prelude
|
||||
|
||||
-- | Add new formats here
|
||||
data DeclFormat = Decl LocallyIndexedComponent
|
||||
@ -16,10 +18,22 @@ data DeclFormat = Decl LocallyIndexedComponent
|
||||
|
||||
-- | V1: Decls included `Hash`es inline
|
||||
-- V2: Instead of `Hash`, we use a smaller index.
|
||||
newtype LocallyIndexedComponent
|
||||
= LocallyIndexedComponent (Vector (LocalIds, Decl Symbol))
|
||||
type LocallyIndexedComponent =
|
||||
LocallyIndexedComponent' TextId ObjectId
|
||||
|
||||
newtype LocallyIndexedComponent' t d
|
||||
= LocallyIndexedComponent (Vector (LocalIds' t d, Decl Symbol))
|
||||
deriving (Show)
|
||||
|
||||
type SyncDeclFormat =
|
||||
SyncDeclFormat' TextId ObjectId
|
||||
|
||||
data SyncDeclFormat' t d
|
||||
= SyncTerm (SyncLocallyIndexedComponent' t d)
|
||||
|
||||
newtype SyncLocallyIndexedComponent' t d
|
||||
= SyncLocallyIndexedComponent (Vector (LocalIds' t d, ByteString))
|
||||
|
||||
-- [OldDecl] ==map==> [NewDecl] ==number==> [(NewDecl, Int)] ==sort==> [(NewDecl, Int)] ==> permutation is map snd of that
|
||||
|
||||
-- type List a = Nil | Cons (List a)
|
||||
|
@ -1,6 +1,7 @@
|
||||
module U.Codebase.Sqlite.Patch.Format
|
||||
( PatchFormat (..),
|
||||
PatchLocalIds (..),
|
||||
PatchLocalIds,
|
||||
PatchLocalIds' (..),
|
||||
SyncPatchFormat,
|
||||
SyncPatchFormat' (..),
|
||||
applyPatchDiffs,
|
||||
@ -36,10 +37,9 @@ data PatchLocalIds' t h d = LocalIds
|
||||
type SyncPatchFormat = SyncPatchFormat' PatchObjectId TextId HashId ObjectId
|
||||
|
||||
data SyncPatchFormat' p t h d
|
||||
= SyncFull (PatchLocalIds t h d) ByteString
|
||||
-- | p is the identity of the thing that the diff is relative to
|
||||
| SyncDiff p (PatchLocalIds t h d) ByteString
|
||||
|
||||
= SyncFull (PatchLocalIds' t h d) ByteString
|
||||
| -- | p is the identity of the thing that the diff is relative to
|
||||
SyncDiff p (PatchLocalIds' t h d) ByteString
|
||||
|
||||
-- | Apply a list of patch diffs to a patch, left to right.
|
||||
applyPatchDiffs :: Patch -> [PatchDiff] -> Patch
|
||||
|
@ -128,7 +128,7 @@ module U.Codebase.Sqlite.Queries
|
||||
-- * sync temp entities
|
||||
getMissingDependencyJwtsForTempEntity,
|
||||
tempEntityExists,
|
||||
insertTempEntity,
|
||||
-- insertTempEntity,
|
||||
|
||||
-- * db misc
|
||||
createSchema,
|
||||
|
@ -1,18 +1,18 @@
|
||||
module U.Codebase.Sqlite.TempEntity where
|
||||
|
||||
data TempEntity text noSyncHash hash
|
||||
= TC (TermFormat' text hash)
|
||||
| DC (DeclComponent text hash)
|
||||
| P (Patch text noSyncHash hash)
|
||||
| N (Namespace text hash)
|
||||
| C (Causal hash)
|
||||
deriving stock (Show, Eq, Ord)
|
||||
import qualified U.Codebase.Sqlite.Decl.Format as Decl
|
||||
import qualified U.Codebase.Sqlite.Patch.Format as Patch
|
||||
import qualified U.Codebase.Sqlite.Term.Format as Term
|
||||
import U.Util.Base32Hex (Base32Hex)
|
||||
import Unison.Prelude
|
||||
|
||||
type TempTermFormat text hash =
|
||||
TermFormat
|
||||
-- should just newtype this somewhere
|
||||
type HashJWT = Text
|
||||
|
||||
data TempDeclFormat text hash
|
||||
= Decl [(LocalIds' text hash, ByteString)]
|
||||
data TempEntity
|
||||
= TC (Term.SyncTermFormat' Text HashJWT)
|
||||
| DC (Decl.SyncDeclFormat' Text HashJWT)
|
||||
| P (Patch.SyncPatchFormat' HashJWT Text Base32Hex HashJWT)
|
||||
|
||||
type TempPatchFormat text noSyncHash hash =
|
||||
SyncPatchFormat' hash text noSyncHash hash
|
||||
-- | N (Namespace text hash)
|
||||
-- | C (Causal hash)
|
||||
|
@ -116,7 +116,7 @@ type TermFormat = TermFormat' TextId ObjectId
|
||||
|
||||
data TermFormat' t d = Term (LocallyIndexedComponent' t d)
|
||||
|
||||
type SyncTermFormat = SyncLocallyIndexedComponent' TextId ObjectId
|
||||
type SyncTermFormat = SyncTermFormat' TextId ObjectId
|
||||
|
||||
data SyncTermFormat' t d = SyncTerm (SyncLocallyIndexedComponent' t d)
|
||||
|
||||
|
@ -1,14 +0,0 @@
|
||||
module U.Codebase.TempEntity where
|
||||
|
||||
-- data TempEntity text noSyncHash hash
|
||||
-- = TC (TermFormat' text hash)
|
||||
-- | DC (DeclComponent text hash)
|
||||
-- | P (Patch text noSyncHash hash)
|
||||
-- | N (Namespace text hash)
|
||||
-- | C (Causal hash)
|
||||
-- deriving stock (Show, Eq, Ord)
|
||||
|
||||
-- data TempTermFormat text hash = Term [(LocalIds' text hash, ByteString)]
|
||||
-- data TempDeclFormat text hash = Decl [(LocalIds' text hash, ByteString)]
|
||||
-- type TempPatchFormat text noSyncHash hash =
|
||||
-- SyncPatchFormat' hash text noSyncHash hash
|
@ -4,7 +4,7 @@ cabal-version: 1.12
|
||||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 27799cc371607e70caa5319a1f3002fa135ac262ab2378a58ac5ca391e5d3034
|
||||
-- hash: b4d3c77715f39c915cacffccf179f1ed62bce29ba013cecc3a25c847f5851233
|
||||
|
||||
name: unison-codebase
|
||||
version: 0.0.0
|
||||
@ -27,7 +27,6 @@ library
|
||||
U.Codebase.Referent
|
||||
U.Codebase.Reflog
|
||||
U.Codebase.ShortHash
|
||||
U.Codebase.TempEntity
|
||||
U.Codebase.Term
|
||||
U.Codebase.TermEdit
|
||||
U.Codebase.Type
|
||||
|
Loading…
Reference in New Issue
Block a user