module U.Codebase.Sqlite.Entity where
import U.Codebase.Sqlite.Branch.Format qualified as Namespace
import U.Codebase.Sqlite.Causal qualified as Causal
import U.Codebase.Sqlite.DbId (BranchHashId, BranchObjectId, CausalHashId, HashId, ObjectId, PatchObjectId, TextId)
import U.Codebase.Sqlite.Decl.Format qualified as Decl
import U.Codebase.Sqlite.Patch.Format qualified as Patch
import U.Codebase.Sqlite.TempEntityType (TempEntityType (..))
import U.Codebase.Sqlite.Term.Format qualified as Term
type SyncEntity =
SyncEntity' TextId HashId ObjectId PatchObjectId BranchHashId BranchObjectId CausalHashId
data SyncEntity' text hash defn patch branchh branch causal
= TC (Term.SyncTermFormat' text defn)
| DC (Decl.SyncDeclFormat' text defn)
| N (Namespace.SyncBranchFormat' branch text defn patch (branch, causal))
| P (Patch.SyncPatchFormat' patch text hash defn)
| C (Causal.SyncCausalFormat' causal branchh)
deriving stock (SyncEntity' text hash defn patch branchh branch causal
-> SyncEntity' text hash defn patch branchh branch causal -> Bool
(SyncEntity' text hash defn patch branchh branch causal
-> SyncEntity' text hash defn patch branchh branch causal -> Bool)
-> (SyncEntity' text hash defn patch branchh branch causal
-> SyncEntity' text hash defn patch branchh branch causal -> Bool)
-> Eq (SyncEntity' text hash defn patch branchh branch causal)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall text hash defn patch branchh branch causal.
(Eq text, Eq defn, Eq patch, Eq causal, Eq branch, Eq hash,
Eq branchh) =>
SyncEntity' text hash defn patch branchh branch causal
-> SyncEntity' text hash defn patch branchh branch causal -> Bool
$c== :: forall text hash defn patch branchh branch causal.
(Eq text, Eq defn, Eq patch, Eq causal, Eq branch, Eq hash,
Eq branchh) =>
SyncEntity' text hash defn patch branchh branch causal
-> SyncEntity' text hash defn patch branchh branch causal -> Bool
== :: SyncEntity' text hash defn patch branchh branch causal
-> SyncEntity' text hash defn patch branchh branch causal -> Bool
$c/= :: forall text hash defn patch branchh branch causal.
(Eq text, Eq defn, Eq patch, Eq causal, Eq branch, Eq hash,
Eq branchh) =>
SyncEntity' text hash defn patch branchh branch causal
-> SyncEntity' text hash defn patch branchh branch causal -> Bool
/= :: SyncEntity' text hash defn patch branchh branch causal
-> SyncEntity' text hash defn patch branchh branch causal -> Bool
Eq, Int
-> SyncEntity' text hash defn patch branchh branch causal -> ShowS
[SyncEntity' text hash defn patch branchh branch causal] -> ShowS
SyncEntity' text hash defn patch branchh branch causal -> String
(Int
-> SyncEntity' text hash defn patch branchh branch causal -> ShowS)
-> (SyncEntity' text hash defn patch branchh branch causal
-> String)
-> ([SyncEntity' text hash defn patch branchh branch causal]
-> ShowS)
-> Show (SyncEntity' text hash defn patch branchh branch causal)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall text hash defn patch branchh branch causal.
(Show text, Show defn, Show patch, Show causal, Show branch,
Show hash, Show branchh) =>
Int
-> SyncEntity' text hash defn patch branchh branch causal -> ShowS
forall text hash defn patch branchh branch causal.
(Show text, Show defn, Show patch, Show causal, Show branch,
Show hash, Show branchh) =>
[SyncEntity' text hash defn patch branchh branch causal] -> ShowS
forall text hash defn patch branchh branch causal.
(Show text, Show defn, Show patch, Show causal, Show branch,
Show hash, Show branchh) =>
SyncEntity' text hash defn patch branchh branch causal -> String
$cshowsPrec :: forall text hash defn patch branchh branch causal.
(Show text, Show defn, Show patch, Show causal, Show branch,
Show hash, Show branchh) =>
Int
-> SyncEntity' text hash defn patch branchh branch causal -> ShowS
showsPrec :: Int
-> SyncEntity' text hash defn patch branchh branch causal -> ShowS
$cshow :: forall text hash defn patch branchh branch causal.
(Show text, Show defn, Show patch, Show causal, Show branch,
Show hash, Show branchh) =>
SyncEntity' text hash defn patch branchh branch causal -> String
show :: SyncEntity' text hash defn patch branchh branch causal -> String
$cshowList :: forall text hash defn patch branchh branch causal.
(Show text, Show defn, Show patch, Show causal, Show branch,
Show hash, Show branchh) =>
[SyncEntity' text hash defn patch branchh branch causal] -> ShowS
showList :: [SyncEntity' text hash defn patch branchh branch causal] -> ShowS
Show)
entityType :: SyncEntity' text hash defn patch branchh branch causal -> TempEntityType
entityType :: forall text hash defn patch branchh branch causal.
SyncEntity' text hash defn patch branchh branch causal
-> TempEntityType
entityType = \case
TC SyncTermFormat' text defn
_ -> TempEntityType
TermComponentType
DC SyncDeclFormat' text defn
_ -> TempEntityType
DeclComponentType
N SyncBranchFormat' branch text defn patch (branch, causal)
_ -> TempEntityType
NamespaceType
P SyncPatchFormat' patch text hash defn
_ -> TempEntityType
PatchType
C SyncCausalFormat' causal branchh
_ -> TempEntityType
CausalType