{-# LANGUAGE DerivingVia #-}
module U.Codebase.Sqlite.Term.Format where
import Data.ByteString (ByteString)
import Data.Text (Text)
import Data.Vector (Vector)
import U.Codebase.Reference (Reference')
import U.Codebase.Referent (Referent')
import U.Codebase.Sqlite.DbId (ObjectId, TextId)
import U.Codebase.Sqlite.LocalIds (LocalDefnId, LocalIds', LocalTextId, WatchLocalIds)
import U.Codebase.Sqlite.Reference qualified as Sqlite
import U.Codebase.Sqlite.Symbol (Symbol)
import U.Codebase.Term qualified as Term
import U.Codebase.Type qualified as Type
import U.Core.ABT qualified as ABT
import Unison.Hash32 (Hash32)
type TermRef = Reference' LocalTextId (Maybe LocalDefnId)
type TypeRef = Reference' LocalTextId LocalDefnId
type TermLink = Referent' TermRef TypeRef
type TypeLink = TypeRef
type LocallyIndexedComponent = LocallyIndexedComponent' TextId ObjectId
type HashLocallyIndexedComponent = LocallyIndexedComponent' Text Hash32
newtype LocallyIndexedComponent' t d = LocallyIndexedComponent
{forall t d.
LocallyIndexedComponent' t d -> Vector (LocalIds' t d, Term, Type)
unLocallyIndexedComponent :: Vector (LocalIds' t d, Term, Type)}
deriving (Int -> LocallyIndexedComponent' t d -> ShowS
[LocallyIndexedComponent' t d] -> ShowS
LocallyIndexedComponent' t d -> String
(Int -> LocallyIndexedComponent' t d -> ShowS)
-> (LocallyIndexedComponent' t d -> String)
-> ([LocallyIndexedComponent' t d] -> ShowS)
-> Show (LocallyIndexedComponent' t d)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall t d.
(Show t, Show d) =>
Int -> LocallyIndexedComponent' t d -> ShowS
forall t d.
(Show t, Show d) =>
[LocallyIndexedComponent' t d] -> ShowS
forall t d.
(Show t, Show d) =>
LocallyIndexedComponent' t d -> String
$cshowsPrec :: forall t d.
(Show t, Show d) =>
Int -> LocallyIndexedComponent' t d -> ShowS
showsPrec :: Int -> LocallyIndexedComponent' t d -> ShowS
$cshow :: forall t d.
(Show t, Show d) =>
LocallyIndexedComponent' t d -> String
show :: LocallyIndexedComponent' t d -> String
$cshowList :: forall t d.
(Show t, Show d) =>
[LocallyIndexedComponent' t d] -> ShowS
showList :: [LocallyIndexedComponent' t d] -> ShowS
Show)
newtype SyncLocallyIndexedComponent' t d
= SyncLocallyIndexedComponent (Vector (LocalIds' t d, ByteString))
type F =
Term.F' LocalTextId TermRef TypeRef TermLink TypeLink Symbol
type FT = Type.F' TypeRef
type Term = ABT.Term F Symbol ()
type Type = ABT.Term FT Symbol ()
type FTT = Type.F' Sqlite.Reference
type TypeOfTerm = ABT.Term FTT Symbol ()
type TermFormat = TermFormat' TextId ObjectId
type HashTermFormat = TermFormat' Text Hash32
data TermFormat' t d = Term (LocallyIndexedComponent' t d)
type SyncTermFormat = SyncTermFormat' TextId ObjectId
data SyncTermFormat' t d = SyncTerm (SyncLocallyIndexedComponent' t d)
data WatchResultFormat
= WatchResult WatchLocalIds Term
data SyncWatchResultFormat
= SyncWatchResult WatchLocalIds ByteString