{-# LANGUAGE RecordWildCards #-}
module U.Codebase.Sqlite.Serialization
( decomposeBranchFormat,
decomposeDeclFormat,
decomposePatchFormat,
decomposeTermFormat,
decomposeWatchFormat,
getBranchFormat,
getLocalBranch,
getDeclElement,
getDeclElementNumConstructors,
getDeclFormat,
getPatchFormat,
getLocalPatch,
getTempCausalFormat,
getTempDeclFormat,
getTempNamespaceFormat,
getTempPatchFormat,
getTempTermFormat,
getTermAndType,
getTypeFromTermAndType,
getTermFormat,
getWatchResultFormat,
lookupDeclElement,
lookupDeclElementNumConstructors,
lookupTermElement,
lookupTermElementDiscardingTerm,
lookupTermElementDiscardingType,
putBranchFormat,
putDeclFormat,
putPatchFormat,
putTempEntity,
putTermFormat,
putWatchResultFormat,
recomposeBranchFormat,
recomposeDeclFormat,
recomposePatchFormat,
recomposeTermFormat,
recomposeWatchFormat,
putTermAndType,
putSingleTerm,
putDeclElement,
getSingleTerm,
putLocalIdsWith,
getLocalIdsWith,
putLocalBranch,
putLocalPatch,
)
where
import Data.Bits (Bits)
import Data.ByteString qualified as BS
import Data.Bytes.Get (MonadGet, getByteString, getWord8, runGetS)
import Data.Bytes.Put (MonadPut, putByteString, putWord8)
import Data.Bytes.Serial (SerialEndian (serializeBE), deserialize, deserializeBE, serialize)
import Data.Bytes.VarInt (VarInt (VarInt), unVarInt)
import Data.List (elemIndex)
import Data.Set qualified as Set
import Data.Vector (Vector)
import U.Codebase.Decl (Modifier)
import U.Codebase.Decl qualified as Decl
import U.Codebase.Kind (Kind)
import U.Codebase.Kind qualified as Kind
import U.Codebase.Reference (Reference' (ReferenceBuiltin, ReferenceDerived))
import U.Codebase.Reference qualified as Reference
import U.Codebase.Referent (Referent')
import U.Codebase.Referent qualified as Referent
import U.Codebase.Sqlite.Branch.Diff qualified as BranchDiff
import U.Codebase.Sqlite.Branch.Format qualified as BranchFormat
import U.Codebase.Sqlite.Branch.Full qualified as BranchFull
import U.Codebase.Sqlite.Causal qualified as Causal
import U.Codebase.Sqlite.DbId (ObjectId, TextId)
import U.Codebase.Sqlite.Decl.Format qualified as DeclFormat
import U.Codebase.Sqlite.Entity qualified as Entity
import U.Codebase.Sqlite.LocalIds (LocalIds, LocalIds' (..), LocalTextId, WatchLocalIds)
import U.Codebase.Sqlite.Patch.Diff qualified as PatchDiff
import U.Codebase.Sqlite.Patch.Format qualified as PatchFormat
import U.Codebase.Sqlite.Patch.Full qualified as PatchFull
import U.Codebase.Sqlite.Patch.TermEdit qualified as TermEdit
import U.Codebase.Sqlite.Patch.TypeEdit qualified as TypeEdit
import U.Codebase.Sqlite.Symbol (Symbol (..))
import U.Codebase.Sqlite.TempEntity (TempEntity)
import U.Codebase.Sqlite.TempEntity qualified as TempEntity
import U.Codebase.Sqlite.Term.Format qualified as TermFormat
import U.Codebase.Term qualified as Term
import U.Codebase.Type qualified as Type
import U.Core.ABT qualified as ABT
import U.Util.Base32Hex qualified as Base32Hex
import U.Util.Serialization hiding (debug)
import Unison.Hash32 (Hash32)
import Unison.Hash32 qualified as Hash32
import Unison.Prelude
import Unison.Util.Monoid qualified as Monoid
import Prelude hiding (getChar, putChar)
debug :: Bool
debug :: Bool
debug = Bool
False
putABT ::
(MonadPut m, Foldable f, Functor f, Ord v) =>
(v -> m ()) ->
(a -> m ()) ->
(forall x. (x -> m ()) -> f x -> m ()) ->
ABT.Term f v a ->
m ()
putABT :: forall (m :: * -> *) (f :: * -> *) v a.
(MonadPut m, Foldable f, Functor f, Ord v) =>
(v -> m ())
-> (a -> m ())
-> (forall x. (x -> m ()) -> f x -> m ())
-> Term f v a
-> m ()
putABT v -> m ()
putVar a -> m ()
putA forall x. (x -> m ()) -> f x -> m ()
putF Term f v a
abt =
(v -> m ()) -> [v] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable v -> m ()
putVar [v]
fvs m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Term f v (a, [v]) -> m ()
go (Term f v a -> Term f v (a, [v])
forall v (f :: * -> *) a.
(Ord v, Functor f, Foldable f) =>
Term f v a -> Term f v (a, [v])
annotateBound Term f v a
abt)
where
fvs :: [v]
fvs = Set v -> [v]
forall a. Set a -> [a]
Set.toList (Set v -> [v]) -> Set v -> [v]
forall a b. (a -> b) -> a -> b
$ Term f v a -> Set v
forall (f :: * -> *) v a. Term f v a -> Set v
ABT.freeVars Term f v a
abt
go :: Term f v (a, [v]) -> m ()
go (ABT.Term Set v
_ (a
a, [v]
env) ABT f v (Term f v (a, [v]))
abt) =
a -> m ()
putA a
a m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> case ABT f v (Term f v (a, [v]))
abt of
ABT.Var v
v -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> [v] -> v -> m ()
putVarRef [v]
env v
v
ABT.Tm f (Term f v (a, [v]))
f -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Term f v (a, [v]) -> m ()) -> f (Term f v (a, [v])) -> m ()
forall x. (x -> m ()) -> f x -> m ()
putF Term f v (a, [v]) -> m ()
go f (Term f v (a, [v]))
f
ABT.Abs v
v Term f v (a, [v])
body -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
2 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> v -> m ()
putVar v
v m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Term f v (a, [v]) -> m ()
go Term f v (a, [v])
body
ABT.Cycle Term f v (a, [v])
body -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
3 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Term f v (a, [v]) -> m ()
go Term f v (a, [v])
body
annotateBound :: (Ord v, Functor f, Foldable f) => ABT.Term f v a -> ABT.Term f v (a, [v])
annotateBound :: forall v (f :: * -> *) a.
(Ord v, Functor f, Foldable f) =>
Term f v a -> Term f v (a, [v])
annotateBound = [v] -> Term f v a -> Term f v (a, [v])
forall {a} {f :: * -> *} {a}.
(Ord a, Foldable f, Functor f) =>
[a] -> Term f a a -> Term f a (a, [a])
go []
where
go :: [a] -> Term f a a -> Term f a (a, [a])
go [a]
env Term f a a
t =
let a :: (a, [a])
a = (Term f a a -> a
forall (f :: * -> *) v a. Term f v a -> a
ABT.annotation Term f a a
t, [a]
env)
in case Term f a a -> ABT f a (Term f a a)
forall (f :: * -> *) v a. Term f v a -> ABT f v (Term f v a)
ABT.out Term f a a
t of
ABT.Abs a
v Term f a a
body -> (a, [a]) -> a -> Term f a (a, [a]) -> Term f a (a, [a])
forall v a (f :: * -> *).
Ord v =>
a -> v -> Term f v a -> Term f v a
ABT.abs (a, [a])
a a
v ([a] -> Term f a a -> Term f a (a, [a])
go (a
v a -> [a] -> [a]
forall a. a -> [a] -> [a]
: [a]
env) Term f a a
body)
ABT.Cycle Term f a a
body -> (a, [a]) -> Term f a (a, [a]) -> Term f a (a, [a])
forall a (f :: * -> *) v. a -> Term f v a -> Term f v a
ABT.cycle (a, [a])
a ([a] -> Term f a a -> Term f a (a, [a])
go [a]
env Term f a a
body)
ABT.Tm f (Term f a a)
f -> (a, [a]) -> f (Term f a (a, [a])) -> Term f a (a, [a])
forall (f :: * -> *) v a.
(Foldable f, Ord v) =>
a -> f (Term f v a) -> Term f v a
ABT.tm (a, [a])
a ([a] -> Term f a a -> Term f a (a, [a])
go [a]
env (Term f a a -> Term f a (a, [a]))
-> f (Term f a a) -> f (Term f a (a, [a]))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f (Term f a a)
f)
ABT.Var a
v -> (a, [a]) -> a -> Term f a (a, [a])
forall a v (f :: * -> *). a -> v -> Term f v a
ABT.var (a, [a])
a a
v
putVarRef :: [v] -> v -> m ()
putVarRef [v]
env v
v = case v
v v -> [v] -> Maybe Int
forall a. Eq a => a -> [a] -> Maybe Int
`elemIndex` [v]
env of
Just Int
i -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Int -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Int
i
Maybe Int
Nothing -> case v
v v -> [v] -> Maybe Int
forall a. Eq a => a -> [a] -> Maybe Int
`elemIndex` [v]
fvs of
Just Int
i -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Int -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Int
i
Maybe Int
Nothing -> [Char] -> m ()
forall a. HasCallStack => [Char] -> a
error [Char]
"impossible: var not free or bound"
getABT ::
(MonadGet m, Foldable f, Functor f, Ord v) =>
m v ->
m a ->
(forall x. m x -> m (f x)) ->
m (ABT.Term f v a)
getABT :: forall (m :: * -> *) (f :: * -> *) v a.
(MonadGet m, Foldable f, Functor f, Ord v) =>
m v -> m a -> (forall x. m x -> m (f x)) -> m (Term f v a)
getABT m v
getVar m a
getA forall x. m x -> m (f x)
getF = m v -> m [v]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList m v
getVar m [v] -> ([v] -> m (Term f v a)) -> m (Term f v a)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= [v] -> [v] -> m (Term f v a)
go []
where
go :: [v] -> [v] -> m (Term f v a)
go [v]
env [v]
fvs = do
a
a <- m a
getA
Word8
tag <- m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8
case Word8
tag of
Word8
0 -> do
Word8
tag <- m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8
case Word8
tag of
Word8
0 -> a -> v -> Term f v a
forall a v (f :: * -> *). a -> v -> Term f v a
ABT.var a
a (v -> Term f v a) -> (Int -> v) -> Int -> Term f v a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([v]
env [v] -> Int -> v
forall a. HasCallStack => [a] -> Int -> a
!!) (Int -> Term f v a) -> m Int -> m (Term f v a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Int
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
1 -> a -> v -> Term f v a
forall a v (f :: * -> *). a -> v -> Term f v a
ABT.var a
a (v -> Term f v a) -> (Int -> v) -> Int -> Term f v a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([v]
fvs [v] -> Int -> v
forall a. HasCallStack => [a] -> Int -> a
!!) (Int -> Term f v a) -> m Int -> m (Term f v a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Int
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
_ -> [Char] -> Word8 -> m (Term f v a)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getABT.Var" Word8
tag
Word8
1 -> a -> f (Term f v a) -> Term f v a
forall (f :: * -> *) v a.
(Foldable f, Ord v) =>
a -> f (Term f v a) -> Term f v a
ABT.tm a
a (f (Term f v a) -> Term f v a)
-> m (f (Term f v a)) -> m (Term f v a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Term f v a) -> m (f (Term f v a))
forall x. m x -> m (f x)
getF ([v] -> [v] -> m (Term f v a)
go [v]
env [v]
fvs)
Word8
2 -> do
v
v <- m v
getVar
Term f v a
body <- [v] -> [v] -> m (Term f v a)
go (v
v v -> [v] -> [v]
forall a. a -> [a] -> [a]
: [v]
env) [v]
fvs
pure $ a -> v -> Term f v a -> Term f v a
forall v a (f :: * -> *).
Ord v =>
a -> v -> Term f v a -> Term f v a
ABT.abs a
a v
v Term f v a
body
Word8
3 -> a -> Term f v a -> Term f v a
forall a (f :: * -> *) v. a -> Term f v a -> Term f v a
ABT.cycle a
a (Term f v a -> Term f v a) -> m (Term f v a) -> m (Term f v a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [v] -> [v] -> m (Term f v a)
go [v]
env [v]
fvs
Word8
_ -> [Char] -> Word8 -> m (Term f v a)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getABT" Word8
tag
putLocalIds :: (MonadPut m, Integral t, Bits t, Integral d, Bits d) => LocalIds' t d -> m ()
putLocalIds :: forall (m :: * -> *) t d.
(MonadPut m, Integral t, Bits t, Integral d, Bits d) =>
LocalIds' t d -> m ()
putLocalIds = (t -> m ()) -> (d -> m ()) -> LocalIds' t d -> m ()
forall (m :: * -> *) t d.
MonadPut m =>
(t -> m ()) -> (d -> m ()) -> LocalIds' t d -> m ()
putLocalIdsWith t -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt d -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt
putLocalIdsWith :: (MonadPut m) => (t -> m ()) -> (d -> m ()) -> LocalIds' t d -> m ()
putLocalIdsWith :: forall (m :: * -> *) t d.
MonadPut m =>
(t -> m ()) -> (d -> m ()) -> LocalIds' t d -> m ()
putLocalIdsWith t -> m ()
putText d -> m ()
putDefn LocalIds {Vector t
textLookup :: Vector t
$sel:textLookup:LocalIds :: forall t h. LocalIds' t h -> Vector t
textLookup, Vector d
defnLookup :: Vector d
$sel:defnLookup:LocalIds :: forall t h. LocalIds' t h -> Vector h
defnLookup} = do
(t -> m ()) -> Vector t -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable t -> m ()
putText Vector t
textLookup
(d -> m ()) -> Vector d -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable d -> m ()
putDefn Vector d
defnLookup
getLocalIds :: (MonadGet m, Num t, Bits t, Num h, Bits h) => m (LocalIds' t h)
getLocalIds :: forall (m :: * -> *) t h.
(MonadGet m, Num t, Bits t, Num h, Bits h) =>
m (LocalIds' t h)
getLocalIds = m t -> m h -> m (LocalIds' t h)
forall (m :: * -> *) t d.
MonadGet m =>
m t -> m d -> m (LocalIds' t d)
getLocalIdsWith m t
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m h
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
skipLocalIds :: (MonadGet m) => m ()
skipLocalIds :: forall (m :: * -> *). MonadGet m => m ()
skipLocalIds = forall t d (m :: * -> *). MonadGet m => m t -> m d -> m ()
skipLocalIdsWith @TextId @ObjectId m TextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m ObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
getWatchLocalIds :: (MonadGet m) => m WatchLocalIds
getWatchLocalIds :: forall (m :: * -> *). MonadGet m => m WatchLocalIds
getWatchLocalIds = m TextId -> m HashId -> m WatchLocalIds
forall (m :: * -> *) t d.
MonadGet m =>
m t -> m d -> m (LocalIds' t d)
getLocalIdsWith m TextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m HashId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
getLocalIdsWith :: (MonadGet m) => m t -> m d -> m (LocalIds' t d)
getLocalIdsWith :: forall (m :: * -> *) t d.
MonadGet m =>
m t -> m d -> m (LocalIds' t d)
getLocalIdsWith m t
getText m d
getDefn =
Vector t -> Vector d -> LocalIds' t d
forall t h. Vector t -> Vector h -> LocalIds' t h
LocalIds (Vector t -> Vector d -> LocalIds' t d)
-> m (Vector t) -> m (Vector d -> LocalIds' t d)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m t -> m (Vector t)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m t
getText m (Vector d -> LocalIds' t d) -> m (Vector d) -> m (LocalIds' t d)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m d -> m (Vector d)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m d
getDefn
skipLocalIdsWith :: forall t d m. (MonadGet m) => m t -> m d -> m ()
skipLocalIdsWith :: forall t d (m :: * -> *). MonadGet m => m t -> m d -> m ()
skipLocalIdsWith m t
skipText m d
skipDefn = do
m t -> m ()
forall (m :: * -> *) a. MonadGet m => m a -> m ()
skipVector m t
skipText
m d -> m ()
forall (m :: * -> *) a. MonadGet m => m a -> m ()
skipVector m d
skipDefn
putUnit :: (Applicative m) => () -> m ()
putUnit :: forall (m :: * -> *). Applicative m => () -> m ()
putUnit ()
_ = () -> m ()
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
getUnit :: (Applicative m) => m ()
getUnit :: forall (m :: * -> *). Applicative m => m ()
getUnit = () -> m ()
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
putWatchResultFormat :: (MonadPut m) => TermFormat.WatchResultFormat -> m ()
putWatchResultFormat :: forall (m :: * -> *). MonadPut m => WatchResultFormat -> m ()
putWatchResultFormat = \case
TermFormat.WatchResult WatchLocalIds
ids Term
t -> do
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
WatchLocalIds -> m ()
forall (m :: * -> *) t d.
(MonadPut m, Integral t, Bits t, Integral d, Bits d) =>
LocalIds' t d -> m ()
putLocalIds WatchLocalIds
ids
Term -> m ()
forall (m :: * -> *). MonadPut m => Term -> m ()
putSingleTerm Term
t
getWatchResultFormat :: (MonadGet m) => m TermFormat.WatchResultFormat
getWatchResultFormat :: forall (m :: * -> *). MonadGet m => m WatchResultFormat
getWatchResultFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m WatchResultFormat) -> m WatchResultFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> WatchLocalIds -> Term -> WatchResultFormat
TermFormat.WatchResult (WatchLocalIds -> Term -> WatchResultFormat)
-> m WatchLocalIds -> m (Term -> WatchResultFormat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m WatchLocalIds
forall (m :: * -> *). MonadGet m => m WatchLocalIds
getWatchLocalIds m (Term -> WatchResultFormat) -> m Term -> m WatchResultFormat
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Term
forall (m :: * -> *). MonadGet m => m Term
getSingleTerm
Word8
other -> [Char] -> Word8 -> m WatchResultFormat
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getWatchResultFormat" Word8
other
putTermFormat :: (MonadPut m) => TermFormat.TermFormat -> m ()
putTermFormat :: forall (m :: * -> *). MonadPut m => TermFormat -> m ()
putTermFormat = \case
TermFormat.Term LocallyIndexedComponent' TextId ObjectId
c -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> LocallyIndexedComponent' TextId ObjectId -> m ()
forall (m :: * -> *).
MonadPut m =>
LocallyIndexedComponent' TextId ObjectId -> m ()
putTermComponent LocallyIndexedComponent' TextId ObjectId
c
getTermFormat :: (MonadGet m) => m TermFormat.TermFormat
getTermFormat :: forall (m :: * -> *). MonadGet m => m TermFormat
getTermFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m TermFormat) -> m TermFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> LocallyIndexedComponent' TextId ObjectId -> TermFormat
forall t d. LocallyIndexedComponent' t d -> TermFormat' t d
TermFormat.Term (LocallyIndexedComponent' TextId ObjectId -> TermFormat)
-> m (LocallyIndexedComponent' TextId ObjectId) -> m TermFormat
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (LocallyIndexedComponent' TextId ObjectId)
forall (m :: * -> *).
MonadGet m =>
m (LocallyIndexedComponent' TextId ObjectId)
getTermComponent
Word8
other -> [Char] -> Word8 -> m TermFormat
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTermFormat" Word8
other
putTermComponent ::
(MonadPut m) =>
TermFormat.LocallyIndexedComponent ->
m ()
putTermComponent :: forall (m :: * -> *).
MonadPut m =>
LocallyIndexedComponent' TextId ObjectId -> m ()
putTermComponent LocallyIndexedComponent' TextId ObjectId
t | Bool
debug Bool -> Bool -> Bool
&& [Char] -> Bool -> Bool
forall a. [Char] -> a -> a
trace ([Char]
"putTermComponent " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ LocallyIndexedComponent' TextId ObjectId -> [Char]
forall a. Show a => a -> [Char]
show LocallyIndexedComponent' TextId ObjectId
t) Bool
False = m ()
forall a. HasCallStack => a
undefined
putTermComponent (TermFormat.LocallyIndexedComponent Vector (LocalIds' TextId ObjectId, Term, Type)
v) =
Put (LocalIds' TextId ObjectId, Term, Type)
-> Vector (LocalIds' TextId ObjectId, Term, Type) -> m ()
forall (m :: * -> *) (f :: * -> *) a.
(MonadPut m, Foldable f) =>
Put a -> f a -> m ()
putFramedArray
( \(LocalIds' TextId ObjectId
localIds, Term
term, Type
typ) ->
LocalIds' TextId ObjectId -> m ()
forall (m :: * -> *) t d.
(MonadPut m, Integral t, Bits t, Integral d, Bits d) =>
LocalIds' t d -> m ()
putLocalIds LocalIds' TextId ObjectId
localIds m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> (Term, Type) -> m ()
forall (m :: * -> *). MonadPut m => (Term, Type) -> m ()
putTermAndType (Term
term, Type
typ)
)
Vector (LocalIds' TextId ObjectId, Term, Type)
v
putTermAndType :: (MonadPut m) => (TermFormat.Term, TermFormat.Type) -> m ()
putTermAndType :: forall (m :: * -> *). MonadPut m => (Term, Type) -> m ()
putTermAndType (Term
term, Type
typ) = (forall (m :: * -> *). MonadPut m => Term -> m ()) -> Term -> m ()
forall (m :: * -> *) a. MonadPut m => Put a -> a -> m ()
putFramed Term -> m ()
forall (m :: * -> *). MonadPut m => Term -> m ()
putSingleTerm Term
term m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Type -> m ()
forall (m :: * -> *). MonadPut m => Type -> m ()
putTType Type
typ
putSingleTerm :: (MonadPut m) => TermFormat.Term -> m ()
putSingleTerm :: forall (m :: * -> *). MonadPut m => Term -> m ()
putSingleTerm Term
_t | Bool
debug Bool -> Bool -> Bool
&& [Char] -> Bool -> Bool
forall a. [Char] -> a -> a
trace [Char]
"putSingleTerm" Bool
False = m ()
forall a. HasCallStack => a
undefined
putSingleTerm Term
t = (Symbol -> m ())
-> (() -> m ())
-> (forall x. (x -> m ()) -> F x -> m ())
-> Term
-> m ()
forall (m :: * -> *) (f :: * -> *) v a.
(MonadPut m, Foldable f, Functor f, Ord v) =>
(v -> m ())
-> (a -> m ())
-> (forall x. (x -> m ()) -> f x -> m ())
-> Term f v a
-> m ()
putABT Symbol -> m ()
forall (m :: * -> *). MonadPut m => Symbol -> m ()
putSymbol () -> m ()
forall (m :: * -> *). Applicative m => () -> m ()
putUnit (x -> m ()) -> F x -> m ()
forall x. (x -> m ()) -> F x -> m ()
forall (m :: * -> *) a. MonadPut m => (a -> m ()) -> F a -> m ()
putF Term
t
where
putF :: (MonadPut m) => (a -> m ()) -> TermFormat.F a -> m ()
putF :: forall (m :: * -> *) a. MonadPut m => (a -> m ()) -> F a -> m ()
putF a -> m ()
putChild = \case
Term.Int Int64
n ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Int64 -> m ()
forall (m :: * -> *). MonadPut m => Int64 -> m ()
putInt Int64
n
Term.Nat ConstructorId
n ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ConstructorId -> m ()
forall (m :: * -> *). MonadPut m => ConstructorId -> m ()
putNat ConstructorId
n
Term.Float Double
n ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
2 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Double -> m ()
forall (m :: * -> *). MonadPut m => Double -> m ()
putFloat Double
n
Term.Boolean Bool
b ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
3 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Bool -> m ()
forall (m :: * -> *). MonadPut m => Bool -> m ()
putBoolean Bool
b
Term.Text LocalTextId
t ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
4 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> LocalTextId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt LocalTextId
t
Term.Ref TermRef
r ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
5 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TermRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t (Maybe r) -> m ()
putRecursiveReference TermRef
r
Term.Constructor TypeRef
r ConstructorId
cid ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
6 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference TypeRef
r m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ConstructorId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ConstructorId
cid
Term.Request TypeRef
r ConstructorId
cid ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
7 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference TypeRef
r m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ConstructorId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ConstructorId
cid
Term.Handle a
h a
a ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
8 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
h m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
a
Term.App a
f a
arg ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
9 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
f m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
arg
Term.Ann a
e Type
t ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
10 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
e m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Type -> m ()
forall (m :: * -> *). MonadPut m => Type -> m ()
putTType Type
t
Term.List Seq a
vs ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
11 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (a -> m ()) -> Seq a -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable a -> m ()
putChild Seq a
vs
Term.If a
cond a
t a
f ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
12 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
cond m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
t m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
f
Term.And a
x a
y ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
13 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
x m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
y
Term.Or a
x a
y ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
14 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
x m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
y
Term.Lam a
body ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
15 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
body
Term.LetRec [a]
bs a
body ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
16 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (a -> m ()) -> [a] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable a -> m ()
putChild [a]
bs m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
body
Term.Let a
b a
body ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
17 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
b m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
body
Term.Match a
s [MatchCase LocalTextId TypeRef a]
cases ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
18 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
s m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (MatchCase LocalTextId TypeRef a -> m ())
-> [MatchCase LocalTextId TypeRef a] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable ((a -> m ()) -> MatchCase LocalTextId TypeRef a -> m ()
forall (m :: * -> *) a.
MonadPut m =>
(a -> m ()) -> MatchCase LocalTextId TypeRef a -> m ()
putMatchCase a -> m ()
putChild) [MatchCase LocalTextId TypeRef a]
cases
Term.Char Char
c ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
19 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Char -> m ()
forall (m :: * -> *). MonadPut m => Char -> m ()
putChar Char
c
Term.TermLink TermLink
r ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
20 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (TermRef -> m ()) -> (TypeRef -> m ()) -> TermLink -> m ()
forall (m :: * -> *) r1 r2.
MonadPut m =>
(r1 -> m ()) -> (r2 -> m ()) -> Referent' r1 r2 -> m ()
putReferent' TermRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t (Maybe r) -> m ()
putRecursiveReference TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference TermLink
r
Term.TypeLink TypeRef
r ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
21 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference TypeRef
r
putMatchCase :: (MonadPut m) => (a -> m ()) -> Term.MatchCase LocalTextId TermFormat.TypeRef a -> m ()
putMatchCase :: forall (m :: * -> *) a.
MonadPut m =>
(a -> m ()) -> MatchCase LocalTextId TypeRef a -> m ()
putMatchCase a -> m ()
putChild (Term.MatchCase Pattern LocalTextId TypeRef
pat Maybe a
guard a
body) =
Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern Pattern LocalTextId TypeRef
pat m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (a -> m ()) -> Maybe a -> m ()
forall (m :: * -> *) a.
MonadPut m =>
(a -> m ()) -> Maybe a -> m ()
putMaybe a -> m ()
putChild Maybe a
guard m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putChild a
body
putPattern :: (MonadPut m) => Term.Pattern LocalTextId TermFormat.TypeRef -> m ()
putPattern :: forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern Pattern LocalTextId TypeRef
p = case Pattern LocalTextId TypeRef
p of
Pattern LocalTextId TypeRef
Term.PUnbound -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
Pattern LocalTextId TypeRef
Term.PVar -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1
Term.PBoolean Bool
b -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
2 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Bool -> m ()
forall (m :: * -> *). MonadPut m => Bool -> m ()
putBoolean Bool
b
Term.PInt Int64
n -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
3 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Int64 -> m ()
forall (m :: * -> *). MonadPut m => Int64 -> m ()
putInt Int64
n
Term.PNat ConstructorId
n -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
4 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ConstructorId -> m ()
forall (m :: * -> *). MonadPut m => ConstructorId -> m ()
putNat ConstructorId
n
Term.PFloat Double
n -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
5 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Double -> m ()
forall (m :: * -> *). MonadPut m => Double -> m ()
putFloat Double
n
Term.PConstructor TypeRef
r ConstructorId
cid [Pattern LocalTextId TypeRef]
ps ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
6
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference TypeRef
r
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ConstructorId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ConstructorId
cid
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Pattern LocalTextId TypeRef -> m ())
-> [Pattern LocalTextId TypeRef] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern [Pattern LocalTextId TypeRef]
ps
Term.PAs Pattern LocalTextId TypeRef
p -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
7 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern Pattern LocalTextId TypeRef
p
Term.PEffectPure Pattern LocalTextId TypeRef
p -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
8 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern Pattern LocalTextId TypeRef
p
Term.PEffectBind TypeRef
r ConstructorId
cid [Pattern LocalTextId TypeRef]
args Pattern LocalTextId TypeRef
k ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
9
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference TypeRef
r
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ConstructorId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ConstructorId
cid
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Pattern LocalTextId TypeRef -> m ())
-> [Pattern LocalTextId TypeRef] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern [Pattern LocalTextId TypeRef]
args
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern Pattern LocalTextId TypeRef
k
Term.PSequenceLiteral [Pattern LocalTextId TypeRef]
ps ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
10 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Pattern LocalTextId TypeRef -> m ())
-> [Pattern LocalTextId TypeRef] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern [Pattern LocalTextId TypeRef]
ps
Term.PSequenceOp Pattern LocalTextId TypeRef
l SeqOp
op Pattern LocalTextId TypeRef
r ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
11
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern Pattern LocalTextId TypeRef
l
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> SeqOp -> m ()
forall (m :: * -> *). MonadPut m => SeqOp -> m ()
putSeqOp SeqOp
op
m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Pattern LocalTextId TypeRef -> m ()
forall (m :: * -> *).
MonadPut m =>
Pattern LocalTextId TypeRef -> m ()
putPattern Pattern LocalTextId TypeRef
r
Term.PText LocalTextId
t -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
12 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> LocalTextId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt LocalTextId
t
Term.PChar Char
c -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
13 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Char -> m ()
forall (m :: * -> *). MonadPut m => Char -> m ()
putChar Char
c
putSeqOp :: (MonadPut m) => Term.SeqOp -> m ()
putSeqOp :: forall (m :: * -> *). MonadPut m => SeqOp -> m ()
putSeqOp SeqOp
Term.PCons = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
putSeqOp SeqOp
Term.PSnoc = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1
putSeqOp SeqOp
Term.PConcat = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
2
getTermComponent :: (MonadGet m) => m TermFormat.LocallyIndexedComponent
getTermComponent :: forall (m :: * -> *).
MonadGet m =>
m (LocallyIndexedComponent' TextId ObjectId)
getTermComponent =
Vector (LocalIds' TextId ObjectId, Term, Type)
-> LocallyIndexedComponent' TextId ObjectId
forall t d.
Vector (LocalIds' t d, Term, Type) -> LocallyIndexedComponent' t d
TermFormat.LocallyIndexedComponent
(Vector (LocalIds' TextId ObjectId, Term, Type)
-> LocallyIndexedComponent' TextId ObjectId)
-> m (Vector (LocalIds' TextId ObjectId, Term, Type))
-> m (LocallyIndexedComponent' TextId ObjectId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (LocalIds' TextId ObjectId, Term, Type)
-> m (Vector (LocalIds' TextId ObjectId, Term, Type))
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getFramedArray (m (LocalIds' TextId ObjectId)
-> m Term -> m Type -> m (LocalIds' TextId ObjectId, Term, Type)
forall (m :: * -> *) a b c.
MonadGet m =>
m a -> m b -> m c -> m (a, b, c)
getTuple3 m (LocalIds' TextId ObjectId)
forall (m :: * -> *) t h.
(MonadGet m, Num t, Bits t, Num h, Bits h) =>
m (LocalIds' t h)
getLocalIds ((forall (m :: * -> *). MonadGet m => m Term) -> m Term
forall (m :: * -> *) a. MonadGet m => Get a -> m a
getFramed m Term
forall (m :: * -> *). MonadGet m => m Term
getSingleTerm) m Type
forall (m :: * -> *). MonadGet m => m Type
getTermElementType)
getTermAndType :: (MonadGet m) => m (TermFormat.Term, TermFormat.Type)
getTermAndType :: forall (m :: * -> *). MonadGet m => m (Term, Type)
getTermAndType = (,) (Term -> Type -> (Term, Type))
-> m Term -> m (Type -> (Term, Type))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (forall (m :: * -> *). MonadGet m => m Term) -> m Term
forall (m :: * -> *) a. MonadGet m => Get a -> m a
getFramed m Term
forall (m :: * -> *). MonadGet m => m Term
getSingleTerm m (Type -> (Term, Type)) -> m Type -> m (Term, Type)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Type
forall (m :: * -> *). MonadGet m => m Type
getTermElementType
getTypeFromTermAndType :: (MonadGet m) => m (TermFormat.Type)
getTypeFromTermAndType :: forall (m :: * -> *). MonadGet m => m Type
getTypeFromTermAndType = m ()
forall (m :: * -> *). MonadGet m => m ()
skipFramed m () -> m Type -> m Type
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> m Type
forall (m :: * -> *). MonadGet m => m Type
getTermElementType
getSingleTerm :: (MonadGet m) => m TermFormat.Term
getSingleTerm :: forall (m :: * -> *). MonadGet m => m Term
getSingleTerm = m Symbol -> m () -> (forall x. m x -> m (F x)) -> m Term
forall (m :: * -> *) (f :: * -> *) v a.
(MonadGet m, Foldable f, Functor f, Ord v) =>
m v -> m a -> (forall x. m x -> m (f x)) -> m (Term f v a)
getABT m Symbol
forall (m :: * -> *). MonadGet m => m Symbol
getSymbol m ()
forall (m :: * -> *). Applicative m => m ()
getUnit m x -> m (F x)
forall x. m x -> m (F x)
forall (m :: * -> *) a. MonadGet m => m a -> m (F a)
getF
where
getF :: (MonadGet m) => m a -> m (TermFormat.F a)
getF :: forall (m :: * -> *) a. MonadGet m => m a -> m (F a)
getF m a
getChild =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m (F a)) -> m (F a)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> Int64 -> F a
forall text termRef typeRef termLink typeLink vt a.
Int64 -> F' text termRef typeRef termLink typeLink vt a
Term.Int (Int64 -> F a) -> m Int64 -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Int64
forall (m :: * -> *). MonadGet m => m Int64
getInt
Word8
1 -> ConstructorId -> F a
forall text termRef typeRef termLink typeLink vt a.
ConstructorId -> F' text termRef typeRef termLink typeLink vt a
Term.Nat (ConstructorId -> F a) -> m ConstructorId -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m ConstructorId
forall (m :: * -> *). MonadGet m => m ConstructorId
getNat
Word8
2 -> Double -> F a
forall text termRef typeRef termLink typeLink vt a.
Double -> F' text termRef typeRef termLink typeLink vt a
Term.Float (Double -> F a) -> m Double -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Double
forall (m :: * -> *). MonadGet m => m Double
getFloat
Word8
3 -> Bool -> F a
forall text termRef typeRef termLink typeLink vt a.
Bool -> F' text termRef typeRef termLink typeLink vt a
Term.Boolean (Bool -> F a) -> m Bool -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Bool
forall (m :: * -> *). MonadGet m => m Bool
getBoolean
Word8
4 -> LocalTextId -> F a
forall text termRef typeRef termLink typeLink vt a.
text -> F' text termRef typeRef termLink typeLink vt a
Term.Text (LocalTextId -> F a) -> m LocalTextId -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
5 -> TermRef -> F a
forall text termRef typeRef termLink typeLink vt a.
termRef -> F' text termRef typeRef termLink typeLink vt a
Term.Ref (TermRef -> F a) -> m TermRef -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TermRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t (Maybe r))
getRecursiveReference
Word8
6 -> TypeRef -> ConstructorId -> F a
forall text termRef typeRef termLink typeLink vt a.
typeRef
-> ConstructorId -> F' text termRef typeRef termLink typeLink vt a
Term.Constructor (TypeRef -> ConstructorId -> F a)
-> m TypeRef -> m (ConstructorId -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference m (ConstructorId -> F a) -> m ConstructorId -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
7 -> TypeRef -> ConstructorId -> F a
forall text termRef typeRef termLink typeLink vt a.
typeRef
-> ConstructorId -> F' text termRef typeRef termLink typeLink vt a
Term.Request (TypeRef -> ConstructorId -> F a)
-> m TypeRef -> m (ConstructorId -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference m (ConstructorId -> F a) -> m ConstructorId -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
8 -> a -> a -> F a
forall text termRef typeRef termLink typeLink vt a.
a -> a -> F' text termRef typeRef termLink typeLink vt a
Term.Handle (a -> a -> F a) -> m a -> m (a -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild m (a -> F a) -> m a -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild
Word8
9 -> a -> a -> F a
forall text termRef typeRef termLink typeLink vt a.
a -> a -> F' text termRef typeRef termLink typeLink vt a
Term.App (a -> a -> F a) -> m a -> m (a -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild m (a -> F a) -> m a -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild
Word8
10 -> a -> Type -> F a
forall text termRef typeRef termLink typeLink vt a.
a
-> TypeR typeRef vt
-> F' text termRef typeRef termLink typeLink vt a
Term.Ann (a -> Type -> F a) -> m a -> m (Type -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild m (Type -> F a) -> m Type -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m TypeRef -> m Type
forall (m :: * -> *) r. MonadGet m => m r -> m (TypeR r Symbol)
getType m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
Word8
11 -> Seq a -> F a
forall text termRef typeRef termLink typeLink vt a.
Seq a -> F' text termRef typeRef termLink typeLink vt a
Term.List (Seq a -> F a) -> m (Seq a) -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a -> m (Seq a)
forall (m :: * -> *) a. MonadGet m => m a -> m (Seq a)
getSequence m a
getChild
Word8
12 -> a -> a -> a -> F a
forall text termRef typeRef termLink typeLink vt a.
a -> a -> a -> F' text termRef typeRef termLink typeLink vt a
Term.If (a -> a -> a -> F a) -> m a -> m (a -> a -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild m (a -> a -> F a) -> m a -> m (a -> F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild m (a -> F a) -> m a -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild
Word8
13 -> a -> a -> F a
forall text termRef typeRef termLink typeLink vt a.
a -> a -> F' text termRef typeRef termLink typeLink vt a
Term.And (a -> a -> F a) -> m a -> m (a -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild m (a -> F a) -> m a -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild
Word8
14 -> a -> a -> F a
forall text termRef typeRef termLink typeLink vt a.
a -> a -> F' text termRef typeRef termLink typeLink vt a
Term.Or (a -> a -> F a) -> m a -> m (a -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild m (a -> F a) -> m a -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild
Word8
15 -> a -> F a
forall text termRef typeRef termLink typeLink vt a.
a -> F' text termRef typeRef termLink typeLink vt a
Term.Lam (a -> F a) -> m a -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild
Word8
16 -> [a] -> a -> F a
forall text termRef typeRef termLink typeLink vt a.
[a] -> a -> F' text termRef typeRef termLink typeLink vt a
Term.LetRec ([a] -> a -> F a) -> m [a] -> m (a -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a -> m [a]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList m a
getChild m (a -> F a) -> m a -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild
Word8
17 -> a -> a -> F a
forall text termRef typeRef termLink typeLink vt a.
a -> a -> F' text termRef typeRef termLink typeLink vt a
Term.Let (a -> a -> F a) -> m a -> m (a -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild m (a -> F a) -> m a -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild
Word8
18 ->
a -> [MatchCase LocalTextId TypeRef a] -> F a
forall text termRef typeRef termLink typeLink vt a.
a
-> [MatchCase text typeRef a]
-> F' text termRef typeRef termLink typeLink vt a
Term.Match
(a -> [MatchCase LocalTextId TypeRef a] -> F a)
-> m a -> m ([MatchCase LocalTextId TypeRef a] -> F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getChild
m ([MatchCase LocalTextId TypeRef a] -> F a)
-> m [MatchCase LocalTextId TypeRef a] -> m (F a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (MatchCase LocalTextId TypeRef a)
-> m [MatchCase LocalTextId TypeRef a]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList
(Pattern LocalTextId TypeRef
-> Maybe a -> a -> MatchCase LocalTextId TypeRef a
forall t r a. Pattern t r -> Maybe a -> a -> MatchCase t r a
Term.MatchCase (Pattern LocalTextId TypeRef
-> Maybe a -> a -> MatchCase LocalTextId TypeRef a)
-> m (Pattern LocalTextId TypeRef)
-> m (Maybe a -> a -> MatchCase LocalTextId TypeRef a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern m (Maybe a -> a -> MatchCase LocalTextId TypeRef a)
-> m (Maybe a) -> m (a -> MatchCase LocalTextId TypeRef a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a -> m (Maybe a)
forall (m :: * -> *) a. MonadGet m => m a -> m (Maybe a)
getMaybe m a
getChild m (a -> MatchCase LocalTextId TypeRef a)
-> m a -> m (MatchCase LocalTextId TypeRef a)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
getChild)
Word8
19 -> Char -> F a
forall text termRef typeRef termLink typeLink vt a.
Char -> F' text termRef typeRef termLink typeLink vt a
Term.Char (Char -> F a) -> m Char -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Char
forall (m :: * -> *). MonadGet m => m Char
getChar
Word8
20 -> TermLink -> F a
forall text termRef typeRef termLink typeLink vt a.
termLink -> F' text termRef typeRef termLink typeLink vt a
Term.TermLink (TermLink -> F a) -> m TermLink -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TermLink
forall (m :: * -> *). MonadGet m => m TermLink
getReferent
Word8
21 -> TypeRef -> F a
forall text termRef typeRef termLink typeLink vt a.
typeLink -> F' text termRef typeRef termLink typeLink vt a
Term.TypeLink (TypeRef -> F a) -> m TypeRef -> m (F a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
Word8
tag -> [Char] -> Word8 -> m (F a)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getSingleTerm" Word8
tag
where
getReferent :: (MonadGet m) => m (Referent' TermFormat.TermRef TermFormat.TypeRef)
getReferent :: forall (m :: * -> *). MonadGet m => m TermLink
getReferent =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m TermLink) -> m TermLink
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> TermRef -> TermLink
forall termRef typeRef. termRef -> Referent' termRef typeRef
Referent.Ref (TermRef -> TermLink) -> m TermRef -> m TermLink
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TermRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t (Maybe r))
getRecursiveReference
Word8
1 -> TypeRef -> ConstructorId -> TermLink
forall termRef typeRef.
typeRef -> ConstructorId -> Referent' termRef typeRef
Referent.Con (TypeRef -> ConstructorId -> TermLink)
-> m TypeRef -> m (ConstructorId -> TermLink)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference m (ConstructorId -> TermLink) -> m ConstructorId -> m TermLink
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
x -> [Char] -> Word8 -> m TermLink
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTermComponent" Word8
x
getPattern :: (MonadGet m) => m (Term.Pattern LocalTextId TermFormat.TypeRef)
getPattern :: forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (Pattern LocalTextId TypeRef))
-> m (Pattern LocalTextId TypeRef)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> Pattern LocalTextId TypeRef -> m (Pattern LocalTextId TypeRef)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Pattern LocalTextId TypeRef
forall t r. Pattern t r
Term.PUnbound
Word8
1 -> Pattern LocalTextId TypeRef -> m (Pattern LocalTextId TypeRef)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Pattern LocalTextId TypeRef
forall t r. Pattern t r
Term.PVar
Word8
2 -> Bool -> Pattern LocalTextId TypeRef
forall t r. Bool -> Pattern t r
Term.PBoolean (Bool -> Pattern LocalTextId TypeRef)
-> m Bool -> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Bool
forall (m :: * -> *). MonadGet m => m Bool
getBoolean
Word8
3 -> Int64 -> Pattern LocalTextId TypeRef
forall t r. Int64 -> Pattern t r
Term.PInt (Int64 -> Pattern LocalTextId TypeRef)
-> m Int64 -> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Int64
forall (m :: * -> *). MonadGet m => m Int64
getInt
Word8
4 -> ConstructorId -> Pattern LocalTextId TypeRef
forall t r. ConstructorId -> Pattern t r
Term.PNat (ConstructorId -> Pattern LocalTextId TypeRef)
-> m ConstructorId -> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m ConstructorId
forall (m :: * -> *). MonadGet m => m ConstructorId
getNat
Word8
5 -> Double -> Pattern LocalTextId TypeRef
forall t r. Double -> Pattern t r
Term.PFloat (Double -> Pattern LocalTextId TypeRef)
-> m Double -> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Double
forall (m :: * -> *). MonadGet m => m Double
getFloat
Word8
6 -> TypeRef
-> ConstructorId
-> [Pattern LocalTextId TypeRef]
-> Pattern LocalTextId TypeRef
forall t r. r -> ConstructorId -> [Pattern t r] -> Pattern t r
Term.PConstructor (TypeRef
-> ConstructorId
-> [Pattern LocalTextId TypeRef]
-> Pattern LocalTextId TypeRef)
-> m TypeRef
-> m (ConstructorId
-> [Pattern LocalTextId TypeRef] -> Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference m (ConstructorId
-> [Pattern LocalTextId TypeRef] -> Pattern LocalTextId TypeRef)
-> m ConstructorId
-> m ([Pattern LocalTextId TypeRef] -> Pattern LocalTextId TypeRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m ([Pattern LocalTextId TypeRef] -> Pattern LocalTextId TypeRef)
-> m [Pattern LocalTextId TypeRef]
-> m (Pattern LocalTextId TypeRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Pattern LocalTextId TypeRef) -> m [Pattern LocalTextId TypeRef]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern
Word8
7 -> Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef
forall t r. Pattern t r -> Pattern t r
Term.PAs (Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern
Word8
8 -> Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef
forall t r. Pattern t r -> Pattern t r
Term.PEffectPure (Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern
Word8
9 ->
TypeRef
-> ConstructorId
-> [Pattern LocalTextId TypeRef]
-> Pattern LocalTextId TypeRef
-> Pattern LocalTextId TypeRef
forall t r.
r -> ConstructorId -> [Pattern t r] -> Pattern t r -> Pattern t r
Term.PEffectBind
(TypeRef
-> ConstructorId
-> [Pattern LocalTextId TypeRef]
-> Pattern LocalTextId TypeRef
-> Pattern LocalTextId TypeRef)
-> m TypeRef
-> m (ConstructorId
-> [Pattern LocalTextId TypeRef]
-> Pattern LocalTextId TypeRef
-> Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
m (ConstructorId
-> [Pattern LocalTextId TypeRef]
-> Pattern LocalTextId TypeRef
-> Pattern LocalTextId TypeRef)
-> m ConstructorId
-> m ([Pattern LocalTextId TypeRef]
-> Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
m ([Pattern LocalTextId TypeRef]
-> Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
-> m [Pattern LocalTextId TypeRef]
-> m (Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Pattern LocalTextId TypeRef) -> m [Pattern LocalTextId TypeRef]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern
m (Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern
Word8
10 -> [Pattern LocalTextId TypeRef] -> Pattern LocalTextId TypeRef
forall t r. [Pattern t r] -> Pattern t r
Term.PSequenceLiteral ([Pattern LocalTextId TypeRef] -> Pattern LocalTextId TypeRef)
-> m [Pattern LocalTextId TypeRef]
-> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Pattern LocalTextId TypeRef) -> m [Pattern LocalTextId TypeRef]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern
Word8
11 ->
Pattern LocalTextId TypeRef
-> SeqOp
-> Pattern LocalTextId TypeRef
-> Pattern LocalTextId TypeRef
forall t r. Pattern t r -> SeqOp -> Pattern t r -> Pattern t r
Term.PSequenceOp
(Pattern LocalTextId TypeRef
-> SeqOp
-> Pattern LocalTextId TypeRef
-> Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
-> m (SeqOp
-> Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern
m (SeqOp
-> Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
-> m SeqOp
-> m (Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m SeqOp
forall (m :: * -> *). MonadGet m => m SeqOp
getSeqOp
m (Pattern LocalTextId TypeRef -> Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
-> m (Pattern LocalTextId TypeRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Pattern LocalTextId TypeRef)
forall (m :: * -> *). MonadGet m => m (Pattern LocalTextId TypeRef)
getPattern
Word8
12 -> LocalTextId -> Pattern LocalTextId TypeRef
forall t r. t -> Pattern t r
Term.PText (LocalTextId -> Pattern LocalTextId TypeRef)
-> m LocalTextId -> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
13 -> Char -> Pattern LocalTextId TypeRef
forall t r. Char -> Pattern t r
Term.PChar (Char -> Pattern LocalTextId TypeRef)
-> m Char -> m (Pattern LocalTextId TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Char
forall (m :: * -> *). MonadGet m => m Char
getChar
Word8
x -> [Char] -> Word8 -> m (Pattern LocalTextId TypeRef)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"Pattern" Word8
x
where
getSeqOp :: (MonadGet m) => m Term.SeqOp
getSeqOp :: forall (m :: * -> *). MonadGet m => m SeqOp
getSeqOp =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m SeqOp) -> m SeqOp
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> SeqOp -> m SeqOp
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SeqOp
Term.PCons
Word8
1 -> SeqOp -> m SeqOp
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SeqOp
Term.PSnoc
Word8
2 -> SeqOp -> m SeqOp
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SeqOp
Term.PConcat
Word8
tag -> [Char] -> Word8 -> m SeqOp
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"SeqOp" Word8
tag
lookupTermElement :: (MonadGet m) => Reference.Pos -> m (LocalIds, TermFormat.Term, TermFormat.Type)
lookupTermElement :: forall (m :: * -> *).
MonadGet m =>
ConstructorId -> m (LocalIds' TextId ObjectId, Term, Type)
lookupTermElement ConstructorId
i =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (LocalIds' TextId ObjectId, Term, Type))
-> m (LocalIds' TextId ObjectId, Term, Type)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> m (LocalIds' TextId ObjectId, Term, Type)
-> Int -> m (LocalIds' TextId ObjectId, Term, Type)
forall (m :: * -> *) a. MonadGet m => m a -> Int -> m a
unsafeFramedArrayLookup (m (LocalIds' TextId ObjectId)
-> m Term -> m Type -> m (LocalIds' TextId ObjectId, Term, Type)
forall (m :: * -> *) a b c.
MonadGet m =>
m a -> m b -> m c -> m (a, b, c)
getTuple3 m (LocalIds' TextId ObjectId)
forall (m :: * -> *) t h.
(MonadGet m, Num t, Bits t, Num h, Bits h) =>
m (LocalIds' t h)
getLocalIds ((forall (m :: * -> *). MonadGet m => m Term) -> m Term
forall (m :: * -> *) a. MonadGet m => Get a -> m a
getFramed m Term
forall (m :: * -> *). MonadGet m => m Term
getSingleTerm) m Type
forall (m :: * -> *). MonadGet m => m Type
getTermElementType) (Int -> m (LocalIds' TextId ObjectId, Term, Type))
-> Int -> m (LocalIds' TextId ObjectId, Term, Type)
forall a b. (a -> b) -> a -> b
$ ConstructorId -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ConstructorId
i
Word8
tag -> [Char] -> Word8 -> m (LocalIds' TextId ObjectId, Term, Type)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"lookupTermElement" Word8
tag
lookupTermElementDiscardingType :: (MonadGet m) => Reference.Pos -> m (LocalIds, TermFormat.Term)
lookupTermElementDiscardingType :: forall (m :: * -> *).
MonadGet m =>
ConstructorId -> m (LocalIds' TextId ObjectId, Term)
lookupTermElementDiscardingType ConstructorId
i =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (LocalIds' TextId ObjectId, Term))
-> m (LocalIds' TextId ObjectId, Term)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> m (LocalIds' TextId ObjectId, Term)
-> Int -> m (LocalIds' TextId ObjectId, Term)
forall (m :: * -> *) a. MonadGet m => m a -> Int -> m a
unsafeFramedArrayLookup ((,) (LocalIds' TextId ObjectId
-> Term -> (LocalIds' TextId ObjectId, Term))
-> m (LocalIds' TextId ObjectId)
-> m (Term -> (LocalIds' TextId ObjectId, Term))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (LocalIds' TextId ObjectId)
forall (m :: * -> *) t h.
(MonadGet m, Num t, Bits t, Num h, Bits h) =>
m (LocalIds' t h)
getLocalIds m (Term -> (LocalIds' TextId ObjectId, Term))
-> m Term -> m (LocalIds' TextId ObjectId, Term)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall (m :: * -> *). MonadGet m => m Term) -> m Term
forall (m :: * -> *) a. MonadGet m => Get a -> m a
getFramed m Term
forall (m :: * -> *). MonadGet m => m Term
getSingleTerm) (Int -> m (LocalIds' TextId ObjectId, Term))
-> Int -> m (LocalIds' TextId ObjectId, Term)
forall a b. (a -> b) -> a -> b
$ ConstructorId -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ConstructorId
i
Word8
tag -> [Char] -> Word8 -> m (LocalIds' TextId ObjectId, Term)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"lookupTermElementDiscardingType" Word8
tag
lookupTermElementDiscardingTerm :: (MonadGet m) => Reference.Pos -> m (LocalIds, TermFormat.Type)
lookupTermElementDiscardingTerm :: forall (m :: * -> *).
MonadGet m =>
ConstructorId -> m (LocalIds' TextId ObjectId, Type)
lookupTermElementDiscardingTerm ConstructorId
i =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (LocalIds' TextId ObjectId, Type))
-> m (LocalIds' TextId ObjectId, Type)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> m (LocalIds' TextId ObjectId, Type)
-> Int -> m (LocalIds' TextId ObjectId, Type)
forall (m :: * -> *) a. MonadGet m => m a -> Int -> m a
unsafeFramedArrayLookup ((,) (LocalIds' TextId ObjectId
-> Type -> (LocalIds' TextId ObjectId, Type))
-> m (LocalIds' TextId ObjectId)
-> m (Type -> (LocalIds' TextId ObjectId, Type))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (LocalIds' TextId ObjectId)
forall (m :: * -> *) t h.
(MonadGet m, Num t, Bits t, Num h, Bits h) =>
m (LocalIds' t h)
getLocalIds m (Type -> (LocalIds' TextId ObjectId, Type))
-> m () -> m (Type -> (LocalIds' TextId ObjectId, Type))
forall a b. m a -> m b -> m a
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* m ()
forall (m :: * -> *). MonadGet m => m ()
skipFramed m (Type -> (LocalIds' TextId ObjectId, Type))
-> m Type -> m (LocalIds' TextId ObjectId, Type)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Type
forall (m :: * -> *). MonadGet m => m Type
getTermElementType) (Int -> m (LocalIds' TextId ObjectId, Type))
-> Int -> m (LocalIds' TextId ObjectId, Type)
forall a b. (a -> b) -> a -> b
$ ConstructorId -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ConstructorId
i
Word8
tag -> [Char] -> Word8 -> m (LocalIds' TextId ObjectId, Type)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"lookupTermElementDiscardingTerm" Word8
tag
getTermElementType :: (MonadGet m) => m TermFormat.Type
getTermElementType :: forall (m :: * -> *). MonadGet m => m Type
getTermElementType = m TypeRef -> m Type
forall (m :: * -> *) r. MonadGet m => m r -> m (TypeR r Symbol)
getType m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
getType :: forall m r. (MonadGet m) => m r -> m (Type.TypeR r Symbol)
getType :: forall (m :: * -> *) r. MonadGet m => m r -> m (TypeR r Symbol)
getType m r
getReference = m Symbol
-> m ()
-> (forall x. m x -> m (F' r x))
-> m (Term (F' r) Symbol ())
forall (m :: * -> *) (f :: * -> *) v a.
(MonadGet m, Foldable f, Functor f, Ord v) =>
m v -> m a -> (forall x. m x -> m (f x)) -> m (Term f v a)
getABT m Symbol
forall (m :: * -> *). MonadGet m => m Symbol
getSymbol m ()
forall (m :: * -> *). Applicative m => m ()
getUnit m x -> m (F' r x)
forall x. m x -> m (F' r x)
go
where
go :: m x -> m (Type.F' r x)
go :: forall x. m x -> m (F' r x)
go m x
getChild =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m (F' r x)) -> m (F' r x)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> r -> F' r x
forall r a. r -> F' r a
Type.Ref (r -> F' r x) -> m r -> m (F' r x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m r
getReference
Word8
1 -> x -> x -> F' r x
forall r a. a -> a -> F' r a
Type.Arrow (x -> x -> F' r x) -> m x -> m (x -> F' r x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m x
getChild m (x -> F' r x) -> m x -> m (F' r x)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m x
getChild
Word8
2 -> x -> Kind -> F' r x
forall r a. a -> Kind -> F' r a
Type.Ann (x -> Kind -> F' r x) -> m x -> m (Kind -> F' r x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m x
getChild m (Kind -> F' r x) -> m Kind -> m (F' r x)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Kind
MonadGet m => m Kind
getKind
Word8
3 -> x -> x -> F' r x
forall r a. a -> a -> F' r a
Type.App (x -> x -> F' r x) -> m x -> m (x -> F' r x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m x
getChild m (x -> F' r x) -> m x -> m (F' r x)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m x
getChild
Word8
4 -> x -> x -> F' r x
forall r a. a -> a -> F' r a
Type.Effect (x -> x -> F' r x) -> m x -> m (x -> F' r x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m x
getChild m (x -> F' r x) -> m x -> m (F' r x)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m x
getChild
Word8
5 -> [x] -> F' r x
forall r a. [a] -> F' r a
Type.Effects ([x] -> F' r x) -> m [x] -> m (F' r x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m x -> m [x]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList m x
getChild
Word8
6 -> x -> F' r x
forall r a. a -> F' r a
Type.Forall (x -> F' r x) -> m x -> m (F' r x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m x
getChild
Word8
7 -> x -> F' r x
forall r a. a -> F' r a
Type.IntroOuter (x -> F' r x) -> m x -> m (F' r x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m x
getChild
Word8
tag -> [Char] -> Word8 -> m (F' r x)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getType" Word8
tag
getKind :: (MonadGet m) => m Kind
getKind :: MonadGet m => m Kind
getKind =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m Kind) -> m Kind
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> Kind -> m Kind
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Kind
Kind.Star
Word8
1 -> Kind -> Kind -> Kind
Kind.Arrow (Kind -> Kind -> Kind) -> m Kind -> m (Kind -> Kind)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Kind
MonadGet m => m Kind
getKind m (Kind -> Kind) -> m Kind -> m Kind
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Kind
MonadGet m => m Kind
getKind
Word8
tag -> [Char] -> Word8 -> m Kind
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getKind" Word8
tag
putDeclFormat :: (MonadPut m) => DeclFormat.DeclFormat -> m ()
putDeclFormat :: forall (m :: * -> *). MonadPut m => DeclFormat -> m ()
putDeclFormat = \case
DeclFormat.Decl LocallyIndexedComponent' TextId ObjectId
c -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> LocallyIndexedComponent' TextId ObjectId -> m ()
forall (m :: * -> *).
MonadPut m =>
LocallyIndexedComponent' TextId ObjectId -> m ()
putDeclComponent LocallyIndexedComponent' TextId ObjectId
c
where
putDeclComponent :: (MonadPut m) => DeclFormat.LocallyIndexedComponent -> m ()
putDeclComponent :: forall (m :: * -> *).
MonadPut m =>
LocallyIndexedComponent' TextId ObjectId -> m ()
putDeclComponent LocallyIndexedComponent' TextId ObjectId
t | Bool
debug Bool -> Bool -> Bool
&& [Char] -> Bool -> Bool
forall a. [Char] -> a -> a
trace ([Char]
"putDeclComponent " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ LocallyIndexedComponent' TextId ObjectId -> [Char]
forall a. Show a => a -> [Char]
show LocallyIndexedComponent' TextId ObjectId
t) Bool
False = m ()
forall a. HasCallStack => a
undefined
putDeclComponent (DeclFormat.LocallyIndexedComponent Vector (LocalIds' TextId ObjectId, Decl Symbol)
v) =
Put (LocalIds' TextId ObjectId, Decl Symbol)
-> Vector (LocalIds' TextId ObjectId, Decl Symbol) -> m ()
forall (m :: * -> *) (f :: * -> *) a.
(MonadPut m, Foldable f) =>
Put a -> f a -> m ()
putFramedArray ((LocalIds' TextId ObjectId -> m ())
-> (Decl Symbol -> m ())
-> (LocalIds' TextId ObjectId, Decl Symbol)
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> (a, b) -> m ()
putPair LocalIds' TextId ObjectId -> m ()
forall (m :: * -> *) t d.
(MonadPut m, Integral t, Bits t, Integral d, Bits d) =>
LocalIds' t d -> m ()
putLocalIds Decl Symbol -> m ()
forall (m :: * -> *). MonadPut m => Decl Symbol -> m ()
putDeclElement) Vector (LocalIds' TextId ObjectId, Decl Symbol)
v
putDeclElement :: (MonadPut m) => Decl.DeclR DeclFormat.TypeRef Symbol -> m ()
putDeclElement :: forall (m :: * -> *). MonadPut m => Decl Symbol -> m ()
putDeclElement Decl.DataDeclaration {[TypeR TermRef Symbol]
[Symbol]
Modifier
DeclType
declType :: DeclType
modifier :: Modifier
bound :: [Symbol]
constructorTypes :: [TypeR TermRef Symbol]
$sel:declType:DataDeclaration :: forall r v. DeclR r v -> DeclType
$sel:modifier:DataDeclaration :: forall r v. DeclR r v -> Modifier
$sel:bound:DataDeclaration :: forall r v. DeclR r v -> [v]
$sel:constructorTypes:DataDeclaration :: forall r v. DeclR r v -> [TypeR r v]
..} = do
DeclType -> m ()
forall {m :: * -> *}. MonadPut m => DeclType -> m ()
putDeclType DeclType
declType
Modifier -> m ()
forall {m :: * -> *}. MonadPut m => Modifier -> m ()
putModifier Modifier
modifier
(Symbol -> m ()) -> [Symbol] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Symbol -> m ()
forall (m :: * -> *). MonadPut m => Symbol -> m ()
putSymbol [Symbol]
bound
(TypeR TermRef Symbol -> m ()) -> [TypeR TermRef Symbol] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TypeR TermRef Symbol -> m ()
forall (m :: * -> *). MonadPut m => TypeR TermRef Symbol -> m ()
putDType [TypeR TermRef Symbol]
constructorTypes
where
putDeclType :: DeclType -> m ()
putDeclType DeclType
Decl.Data = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
putDeclType DeclType
Decl.Effect = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1
putModifier :: Modifier -> m ()
putModifier Modifier
Decl.Structural = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
putModifier (Decl.Unique Text
t) = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Text -> m ()
forall (m :: * -> *). MonadPut m => Text -> m ()
putText Text
t
getDeclFormat :: (MonadGet m) => m DeclFormat.DeclFormat
getDeclFormat :: forall (m :: * -> *). MonadGet m => m DeclFormat
getDeclFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m DeclFormat) -> m DeclFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> LocallyIndexedComponent' TextId ObjectId -> DeclFormat
forall text defn.
LocallyIndexedComponent' text defn -> DeclFormat' text defn
DeclFormat.Decl (LocallyIndexedComponent' TextId ObjectId -> DeclFormat)
-> m (LocallyIndexedComponent' TextId ObjectId) -> m DeclFormat
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (LocallyIndexedComponent' TextId ObjectId)
forall (m :: * -> *).
MonadGet m =>
m (LocallyIndexedComponent' TextId ObjectId)
getDeclComponent
Word8
other -> [Char] -> Word8 -> m DeclFormat
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"DeclFormat" Word8
other
where
getDeclComponent :: (MonadGet m) => m DeclFormat.LocallyIndexedComponent
getDeclComponent :: forall (m :: * -> *).
MonadGet m =>
m (LocallyIndexedComponent' TextId ObjectId)
getDeclComponent =
Vector (LocalIds' TextId ObjectId, Decl Symbol)
-> LocallyIndexedComponent' TextId ObjectId
forall t d.
Vector (LocalIds' t d, Decl Symbol) -> LocallyIndexedComponent' t d
DeclFormat.LocallyIndexedComponent
(Vector (LocalIds' TextId ObjectId, Decl Symbol)
-> LocallyIndexedComponent' TextId ObjectId)
-> m (Vector (LocalIds' TextId ObjectId, Decl Symbol))
-> m (LocallyIndexedComponent' TextId ObjectId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (LocalIds' TextId ObjectId, Decl Symbol)
-> m (Vector (LocalIds' TextId ObjectId, Decl Symbol))
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getFramedArray (m (LocalIds' TextId ObjectId)
-> m (Decl Symbol) -> m (LocalIds' TextId ObjectId, Decl Symbol)
forall (m :: * -> *) a b. MonadGet m => m a -> m b -> m (a, b)
getPair m (LocalIds' TextId ObjectId)
forall (m :: * -> *) t h.
(MonadGet m, Num t, Bits t, Num h, Bits h) =>
m (LocalIds' t h)
getLocalIds m (Decl Symbol)
forall (m :: * -> *). MonadGet m => m (Decl Symbol)
getDeclElement)
getDeclElement :: (MonadGet m) => m (DeclFormat.Decl Symbol)
getDeclElement :: forall (m :: * -> *). MonadGet m => m (Decl Symbol)
getDeclElement =
DeclType
-> Modifier -> [Symbol] -> [TypeR TermRef Symbol] -> Decl Symbol
forall r v. DeclType -> Modifier -> [v] -> [TypeR r v] -> DeclR r v
Decl.DataDeclaration
(DeclType
-> Modifier -> [Symbol] -> [TypeR TermRef Symbol] -> Decl Symbol)
-> m DeclType
-> m (Modifier
-> [Symbol] -> [TypeR TermRef Symbol] -> Decl Symbol)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m DeclType
getDeclType
m (Modifier -> [Symbol] -> [TypeR TermRef Symbol] -> Decl Symbol)
-> m Modifier
-> m ([Symbol] -> [TypeR TermRef Symbol] -> Decl Symbol)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Modifier
forall (m :: * -> *). MonadGet m => m Modifier
getModifier
m ([Symbol] -> [TypeR TermRef Symbol] -> Decl Symbol)
-> m [Symbol] -> m ([TypeR TermRef Symbol] -> Decl Symbol)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Symbol -> m [Symbol]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList m Symbol
forall (m :: * -> *). MonadGet m => m Symbol
getSymbol
m ([TypeR TermRef Symbol] -> Decl Symbol)
-> m [TypeR TermRef Symbol] -> m (Decl Symbol)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (TypeR TermRef Symbol) -> m [TypeR TermRef Symbol]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList (m TermRef -> m (TypeR TermRef Symbol)
forall (m :: * -> *) r. MonadGet m => m r -> m (TypeR r Symbol)
getType m TermRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t (Maybe r))
getRecursiveReference)
where
getDeclType :: m DeclType
getDeclType =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m DeclType) -> m DeclType
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> DeclType -> m DeclType
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure DeclType
Decl.Data
Word8
1 -> DeclType -> m DeclType
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure DeclType
Decl.Effect
Word8
other -> [Char] -> Word8 -> m DeclType
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"DeclType" Word8
other
getModifier :: (MonadGet m) => m Modifier
getModifier :: forall (m :: * -> *). MonadGet m => m Modifier
getModifier =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m Modifier) -> m Modifier
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> Modifier -> m Modifier
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Modifier
Decl.Structural
Word8
1 -> Text -> Modifier
Decl.Unique (Text -> Modifier) -> m Text -> m Modifier
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Text
forall (m :: * -> *). MonadGet m => m Text
getText
Word8
other -> [Char] -> Word8 -> m Modifier
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"DeclModifier" Word8
other
getDeclElementNumConstructors :: (MonadGet m) => m Int
getDeclElementNumConstructors :: forall (m :: * -> *). MonadGet m => m Int
getDeclElementNumConstructors = do
m ()
skipDeclType
m ()
skipDeclModifier
m ()
skipDeclTypeVariables
m Int
forall (m :: * -> *). MonadGet m => m Int
getListLength
where
skipDeclType :: m ()
skipDeclType = m Word8 -> m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8
skipDeclModifier :: m ()
skipDeclModifier = m Modifier -> m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void m Modifier
forall (m :: * -> *). MonadGet m => m Modifier
getModifier
skipDeclTypeVariables :: m ()
skipDeclTypeVariables = m [()] -> m ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (m () -> m [()]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList m ()
forall (m :: * -> *). MonadGet m => m ()
skipSymbol)
lookupDeclElement ::
(MonadGet m) => Reference.Pos -> m (LocalIds, DeclFormat.Decl Symbol)
lookupDeclElement :: forall (m :: * -> *).
MonadGet m =>
ConstructorId -> m (LocalIds' TextId ObjectId, Decl Symbol)
lookupDeclElement ConstructorId
i =
ConstructorId
-> m (LocalIds' TextId ObjectId, Decl Symbol)
-> m (LocalIds' TextId ObjectId, Decl Symbol)
forall (m :: * -> *) a. MonadGet m => ConstructorId -> m a -> m a
lookupDeclElementWith ConstructorId
i (m (LocalIds' TextId ObjectId)
-> m (Decl Symbol) -> m (LocalIds' TextId ObjectId, Decl Symbol)
forall (m :: * -> *) a b. MonadGet m => m a -> m b -> m (a, b)
getPair m (LocalIds' TextId ObjectId)
forall (m :: * -> *) t h.
(MonadGet m, Num t, Bits t, Num h, Bits h) =>
m (LocalIds' t h)
getLocalIds m (Decl Symbol)
forall (m :: * -> *). MonadGet m => m (Decl Symbol)
getDeclElement)
lookupDeclElementNumConstructors :: (MonadGet m) => Reference.Pos -> m Int
lookupDeclElementNumConstructors :: forall (m :: * -> *). MonadGet m => ConstructorId -> m Int
lookupDeclElementNumConstructors ConstructorId
i =
ConstructorId -> m Int -> m Int
forall (m :: * -> *) a. MonadGet m => ConstructorId -> m a -> m a
lookupDeclElementWith ConstructorId
i (m ()
forall (m :: * -> *). MonadGet m => m ()
skipLocalIds m () -> m Int -> m Int
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> m Int
forall (m :: * -> *). MonadGet m => m Int
getDeclElementNumConstructors)
lookupDeclElementWith :: (MonadGet m) => Reference.Pos -> m a -> m a
lookupDeclElementWith :: forall (m :: * -> *) a. MonadGet m => ConstructorId -> m a -> m a
lookupDeclElementWith ConstructorId
i m a
get =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m a) -> m a
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> m a -> Int -> m a
forall (m :: * -> *) a. MonadGet m => m a -> Int -> m a
unsafeFramedArrayLookup m a
get (Int -> m a) -> Int -> m a
forall a b. (a -> b) -> a -> b
$ forall a b. (Integral a, Num b) => a -> b
fromIntegral @Reference.Pos @Int ConstructorId
i
Word8
other -> [Char] -> Word8 -> m a
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"lookupDeclElementWith" Word8
other
putBranchFormat :: (MonadPut m) => BranchFormat.BranchFormat -> m ()
putBranchFormat :: forall (m :: * -> *). MonadPut m => BranchFormat -> m ()
putBranchFormat BranchFormat
b | Bool
debug Bool -> Bool -> Bool
&& [Char] -> Bool -> Bool
forall a. [Char] -> a -> a
trace ([Char]
"putBranchFormat " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ BranchFormat -> [Char]
forall a. Show a => a -> [Char]
show BranchFormat
b) Bool
False = m ()
forall a. HasCallStack => a
undefined
putBranchFormat BranchFormat
b = case BranchFormat
b of
BranchFormat.Full BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
li LocalBranch
b -> do
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
forall (m :: * -> *).
MonadPut m =>
BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
putBranchLocalIds BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
li
LocalBranch -> m ()
forall (m :: * -> *). MonadPut m => LocalBranch -> m ()
putLocalBranch LocalBranch
b
BranchFormat.Diff BranchObjectId
r BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
li LocalDiff
d -> do
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1
BranchObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt BranchObjectId
r
BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
forall (m :: * -> *).
MonadPut m =>
BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
putBranchLocalIds BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
li
LocalDiff -> m ()
forall {m :: * -> *} {a} {a} {a} {r}.
(MonadPut m, Integral a, Integral a, Integral a, Integral r,
Bits a, Bits a, Bits a, Bits r) =>
Diff' a r a a -> m ()
putBranchDiff LocalDiff
d
where
putBranchDiff :: Diff' a r a a -> m ()
putBranchDiff (BranchDiff.Diff Map a (Map (Referent'' a r) (DefinitionOp' (Metadata a r)))
terms Map a (Map (Metadata a r) (DefinitionOp' (Metadata a r)))
types Map a (PatchOp' a)
patches Map a (ChildOp' a)
children) = do
(a -> m ())
-> (Map (Referent'' a r) (DefinitionOp' (Metadata a r)) -> m ())
-> Map a (Map (Referent'' a r) (DefinitionOp' (Metadata a r)))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap a -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ((Referent'' a r -> m ())
-> (DefinitionOp' (Metadata a r) -> m ())
-> Map (Referent'' a r) (DefinitionOp' (Metadata a r))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Referent'' a r -> m ()
forall (m :: * -> *) t1 h1 t2 h2.
(MonadPut m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
Referent' (Reference' t1 h1) (Reference' t2 h2) -> m ()
putReferent DefinitionOp' (Metadata a r) -> m ()
putDiffOp) Map a (Map (Referent'' a r) (DefinitionOp' (Metadata a r)))
terms
(a -> m ())
-> (Map (Metadata a r) (DefinitionOp' (Metadata a r)) -> m ())
-> Map a (Map (Metadata a r) (DefinitionOp' (Metadata a r)))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap a -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ((Metadata a r -> m ())
-> (DefinitionOp' (Metadata a r) -> m ())
-> Map (Metadata a r) (DefinitionOp' (Metadata a r))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Metadata a r -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference DefinitionOp' (Metadata a r) -> m ()
putDiffOp) Map a (Map (Metadata a r) (DefinitionOp' (Metadata a r)))
types
(a -> m ()) -> (PatchOp' a -> m ()) -> Map a (PatchOp' a) -> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap a -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt PatchOp' a -> m ()
putPatchOp Map a (PatchOp' a)
patches
(a -> m ()) -> (ChildOp' a -> m ()) -> Map a (ChildOp' a) -> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap a -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ChildOp' a -> m ()
putChildOp Map a (ChildOp' a)
children
where
putAddRemove :: (a -> m ()) -> AddRemove a -> m ()
putAddRemove a -> m ()
put AddRemove a
map = do
let ([a]
adds, [a]
removes) = AddRemove a -> ([a], [a])
forall a. AddRemove a -> ([a], [a])
BranchDiff.addsRemoves AddRemove a
map
(a -> m ()) -> [a] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable a -> m ()
put [a]
adds
(a -> m ()) -> [a] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable a -> m ()
put [a]
removes
putPatchOp :: PatchOp' a -> m ()
putPatchOp = \case
PatchOp' a
BranchDiff.PatchRemove -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
BranchDiff.PatchAddReplace a
pId -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt a
pId
putDiffOp :: DefinitionOp' (Metadata a r) -> m ()
putDiffOp = \case
DefinitionOp' (Metadata a r)
BranchDiff.RemoveDef -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
BranchDiff.AddDefWithMetadata Set (Metadata a r)
md -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Metadata a r -> m ()) -> Set (Metadata a r) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Metadata a r -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference Set (Metadata a r)
md
BranchDiff.AlterDefMetadata AddRemove (Metadata a r)
md -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
2 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Metadata a r -> m ()) -> AddRemove (Metadata a r) -> m ()
forall {m :: * -> *} {a}.
MonadPut m =>
(a -> m ()) -> AddRemove a -> m ()
putAddRemove Metadata a r -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference AddRemove (Metadata a r)
md
putChildOp :: ChildOp' a -> m ()
putChildOp = \case
ChildOp' a
BranchDiff.ChildRemove -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
BranchDiff.ChildAddReplace a
b -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt a
b
putLocalBranch :: (MonadPut m) => BranchFull.LocalBranch -> m ()
putLocalBranch :: forall (m :: * -> *). MonadPut m => LocalBranch -> m ()
putLocalBranch (BranchFull.Branch Map
LocalTextId
(Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId))
terms Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
types Map LocalTextId LocalPatchObjectId
patches Map LocalTextId LocalBranchChildId
children) = do
(LocalTextId -> m ())
-> (Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId)
-> m ())
-> Map
LocalTextId
(Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap LocalTextId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ((Referent'' LocalTextId LocalDefnId -> m ())
-> (MetadataSetFormat' LocalTextId LocalDefnId -> m ())
-> Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId)
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Referent'' LocalTextId LocalDefnId -> m ()
forall (m :: * -> *) t1 h1 t2 h2.
(MonadPut m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
Referent' (Reference' t1 h1) (Reference' t2 h2) -> m ()
putReferent MetadataSetFormat' LocalTextId LocalDefnId -> m ()
forall {f :: * -> *} {t} {r}.
(MonadPut f, Integral t, Integral r, Bits t, Bits r) =>
MetadataSetFormat' t r -> f ()
putMetadataSetFormat) Map
LocalTextId
(Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId))
terms
(LocalTextId -> m ())
-> (Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId)
-> m ())
-> Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap LocalTextId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ((TypeRef -> m ())
-> (MetadataSetFormat' LocalTextId LocalDefnId -> m ())
-> Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId)
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference MetadataSetFormat' LocalTextId LocalDefnId -> m ()
forall {f :: * -> *} {t} {r}.
(MonadPut f, Integral t, Integral r, Bits t, Bits r) =>
MetadataSetFormat' t r -> f ()
putMetadataSetFormat) Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
types
(LocalTextId -> m ())
-> (LocalPatchObjectId -> m ())
-> Map LocalTextId LocalPatchObjectId
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap LocalTextId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt LocalPatchObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Map LocalTextId LocalPatchObjectId
patches
(LocalTextId -> m ())
-> (LocalBranchChildId -> m ())
-> Map LocalTextId LocalBranchChildId
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap LocalTextId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt LocalBranchChildId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Map LocalTextId LocalBranchChildId
children
where
putMetadataSetFormat :: MetadataSetFormat' t r -> f ()
putMetadataSetFormat (BranchFull.Inline Set (Reference' t r)
s) =
Word8 -> f ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 f () -> f () -> f ()
forall a b. f a -> f b -> f b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (Reference' t r -> f ()) -> Set (Reference' t r) -> f ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Reference' t r -> f ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference Set (Reference' t r)
s
putBranchLocalIds :: (MonadPut m) => BranchFormat.BranchLocalIds -> m ()
putBranchLocalIds :: forall (m :: * -> *).
MonadPut m =>
BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
putBranchLocalIds (BranchFormat.LocalIds Vector TextId
ts Vector ObjectId
os Vector PatchObjectId
ps Vector (BranchObjectId, CausalHashId)
cs) = do
(TextId -> m ()) -> Vector TextId -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TextId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Vector TextId
ts
(ObjectId -> m ()) -> Vector ObjectId -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable ObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Vector ObjectId
os
(PatchObjectId -> m ()) -> Vector PatchObjectId -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable PatchObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Vector PatchObjectId
ps
((BranchObjectId, CausalHashId) -> m ())
-> Vector (BranchObjectId, CausalHashId) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable ((BranchObjectId -> m ())
-> (CausalHashId -> m ()) -> (BranchObjectId, CausalHashId) -> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> (a, b) -> m ()
putPair BranchObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt CausalHashId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt) Vector (BranchObjectId, CausalHashId)
cs
putPatchFormat :: (MonadPut m) => PatchFormat.PatchFormat -> m ()
putPatchFormat :: forall (m :: * -> *). MonadPut m => PatchFormat -> m ()
putPatchFormat = \case
PatchFormat.Full PatchLocalIds
ids LocalPatch
p -> do
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
PatchLocalIds -> m ()
forall (m :: * -> *). MonadPut m => PatchLocalIds -> m ()
putPatchLocalIds PatchLocalIds
ids
LocalPatch -> m ()
forall (m :: * -> *). MonadPut m => LocalPatch -> m ()
putLocalPatch LocalPatch
p
PatchFormat.Diff PatchObjectId
r PatchLocalIds
ids LocalPatchDiff
p -> do
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1
PatchObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt PatchObjectId
r
PatchLocalIds -> m ()
forall (m :: * -> *). MonadPut m => PatchLocalIds -> m ()
putPatchLocalIds PatchLocalIds
ids
LocalPatchDiff -> m ()
forall (m :: * -> *). MonadPut m => LocalPatchDiff -> m ()
putPatchDiff LocalPatchDiff
p
getPatchFormat :: (MonadGet m) => m PatchFormat.PatchFormat
getPatchFormat :: forall (m :: * -> *). MonadGet m => m PatchFormat
getPatchFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m PatchFormat) -> m PatchFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> PatchLocalIds -> LocalPatch -> PatchFormat
PatchFormat.Full (PatchLocalIds -> LocalPatch -> PatchFormat)
-> m PatchLocalIds -> m (LocalPatch -> PatchFormat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m PatchLocalIds
forall (m :: * -> *). MonadGet m => m PatchLocalIds
getPatchLocalIds m (LocalPatch -> PatchFormat) -> m LocalPatch -> m PatchFormat
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalPatch
forall (m :: * -> *). MonadGet m => m LocalPatch
getLocalPatch
Word8
1 -> PatchObjectId -> PatchLocalIds -> LocalPatchDiff -> PatchFormat
PatchFormat.Diff (PatchObjectId -> PatchLocalIds -> LocalPatchDiff -> PatchFormat)
-> m PatchObjectId
-> m (PatchLocalIds -> LocalPatchDiff -> PatchFormat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m PatchObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m (PatchLocalIds -> LocalPatchDiff -> PatchFormat)
-> m PatchLocalIds -> m (LocalPatchDiff -> PatchFormat)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m PatchLocalIds
forall (m :: * -> *). MonadGet m => m PatchLocalIds
getPatchLocalIds m (LocalPatchDiff -> PatchFormat)
-> m LocalPatchDiff -> m PatchFormat
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalPatchDiff
forall (m :: * -> *). MonadGet m => m LocalPatchDiff
getPatchDiff
Word8
x -> [Char] -> Word8 -> m PatchFormat
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getPatchFormat" Word8
x
where
getPatchDiff :: (MonadGet m) => m PatchDiff.LocalPatchDiff
getPatchDiff :: forall (m :: * -> *). MonadGet m => m LocalPatchDiff
getPatchDiff =
Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatchDiff
forall t h d.
Map (Referent'' t h) (Set (TermEdit' t d))
-> Map (Reference' t h) (Set (TypeEdit' t d))
-> Map (Referent'' t h) (Set (TermEdit' t d))
-> Map (Reference' t h) (Set (TypeEdit' t d))
-> PatchDiff' t h d
PatchDiff.PatchDiff
(Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatchDiff)
-> m (Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId)))
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatchDiff)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Referent'' LocalTextId LocalHashId)
-> m (Set (TermEdit' LocalTextId LocalDefnId))
-> m (Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m (Referent'' LocalTextId LocalHashId)
forall (m :: * -> *) t1 h1 t2 h2.
(MonadGet m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
m (Referent' (Reference' t1 h1) (Reference' t2 h2))
getReferent (m (TermEdit' LocalTextId LocalDefnId)
-> m (Set (TermEdit' LocalTextId LocalDefnId))
forall (m :: * -> *) a. (MonadGet m, Ord a) => m a -> m (Set a)
getSet m (TermEdit' LocalTextId LocalDefnId)
forall (m :: * -> *).
MonadGet m =>
m (TermEdit' LocalTextId LocalDefnId)
getTermEdit)
m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatchDiff)
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId)))
-> m (Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatchDiff)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Reference' LocalTextId LocalHashId)
-> m (Set (TypeEdit' LocalTextId LocalDefnId))
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m (Reference' LocalTextId LocalHashId)
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference (m (TypeEdit' LocalTextId LocalDefnId)
-> m (Set (TypeEdit' LocalTextId LocalDefnId))
forall (m :: * -> *) a. (MonadGet m, Ord a) => m a -> m (Set a)
getSet m (TypeEdit' LocalTextId LocalDefnId)
forall (m :: * -> *).
MonadGet m =>
m (TypeEdit' LocalTextId LocalDefnId)
getTypeEdit)
m (Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatchDiff)
-> m (Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId)))
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatchDiff)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Referent'' LocalTextId LocalHashId)
-> m (Set (TermEdit' LocalTextId LocalDefnId))
-> m (Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m (Referent'' LocalTextId LocalHashId)
forall (m :: * -> *) t1 h1 t2 h2.
(MonadGet m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
m (Referent' (Reference' t1 h1) (Reference' t2 h2))
getReferent (m (TermEdit' LocalTextId LocalDefnId)
-> m (Set (TermEdit' LocalTextId LocalDefnId))
forall (m :: * -> *) a. (MonadGet m, Ord a) => m a -> m (Set a)
getSet m (TermEdit' LocalTextId LocalDefnId)
forall (m :: * -> *).
MonadGet m =>
m (TermEdit' LocalTextId LocalDefnId)
getTermEdit)
m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatchDiff)
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId)))
-> m LocalPatchDiff
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Reference' LocalTextId LocalHashId)
-> m (Set (TypeEdit' LocalTextId LocalDefnId))
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m (Reference' LocalTextId LocalHashId)
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference (m (TypeEdit' LocalTextId LocalDefnId)
-> m (Set (TypeEdit' LocalTextId LocalDefnId))
forall (m :: * -> *) a. (MonadGet m, Ord a) => m a -> m (Set a)
getSet m (TypeEdit' LocalTextId LocalDefnId)
forall (m :: * -> *).
MonadGet m =>
m (TypeEdit' LocalTextId LocalDefnId)
getTypeEdit)
getLocalPatch :: (MonadGet m) => m PatchFull.LocalPatch
getLocalPatch :: forall (m :: * -> *). MonadGet m => m LocalPatch
getLocalPatch =
Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatch
forall t h o.
Map (Referent'' t h) (Set (TermEdit' t o))
-> Map (Reference' t h) (Set (TypeEdit' t o)) -> Patch' t h o
PatchFull.Patch
(Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatch)
-> m (Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId)))
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatch)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Referent'' LocalTextId LocalHashId)
-> m (Set (TermEdit' LocalTextId LocalDefnId))
-> m (Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m (Referent'' LocalTextId LocalHashId)
forall (m :: * -> *) t1 h1 t2 h2.
(MonadGet m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
m (Referent' (Reference' t1 h1) (Reference' t2 h2))
getReferent (m (TermEdit' LocalTextId LocalDefnId)
-> m (Set (TermEdit' LocalTextId LocalDefnId))
forall (m :: * -> *) a. (MonadGet m, Ord a) => m a -> m (Set a)
getSet m (TermEdit' LocalTextId LocalDefnId)
forall (m :: * -> *).
MonadGet m =>
m (TermEdit' LocalTextId LocalDefnId)
getTermEdit)
m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> LocalPatch)
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId)))
-> m LocalPatch
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Reference' LocalTextId LocalHashId)
-> m (Set (TypeEdit' LocalTextId LocalDefnId))
-> m (Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m (Reference' LocalTextId LocalHashId)
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference (m (TypeEdit' LocalTextId LocalDefnId)
-> m (Set (TypeEdit' LocalTextId LocalDefnId))
forall (m :: * -> *) a. (MonadGet m, Ord a) => m a -> m (Set a)
getSet m (TypeEdit' LocalTextId LocalDefnId)
forall (m :: * -> *).
MonadGet m =>
m (TypeEdit' LocalTextId LocalDefnId)
getTypeEdit)
getTermEdit :: (MonadGet m) => m TermEdit.LocalTermEdit
getTermEdit :: forall (m :: * -> *).
MonadGet m =>
m (TermEdit' LocalTextId LocalDefnId)
getTermEdit =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (TermEdit' LocalTextId LocalDefnId))
-> m (TermEdit' LocalTextId LocalDefnId)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> TermEdit' LocalTextId LocalDefnId
-> m (TermEdit' LocalTextId LocalDefnId)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TermEdit' LocalTextId LocalDefnId
forall t h. TermEdit' t h
TermEdit.Deprecate
Word8
1 -> Referent'' LocalTextId LocalDefnId
-> Typing -> TermEdit' LocalTextId LocalDefnId
forall t h. Referent' t h -> Typing -> TermEdit' t h
TermEdit.Replace (Referent'' LocalTextId LocalDefnId
-> Typing -> TermEdit' LocalTextId LocalDefnId)
-> m (Referent'' LocalTextId LocalDefnId)
-> m (Typing -> TermEdit' LocalTextId LocalDefnId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Referent'' LocalTextId LocalDefnId)
forall (m :: * -> *) t1 h1 t2 h2.
(MonadGet m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
m (Referent' (Reference' t1 h1) (Reference' t2 h2))
getReferent m (Typing -> TermEdit' LocalTextId LocalDefnId)
-> m Typing -> m (TermEdit' LocalTextId LocalDefnId)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Typing
forall (m :: * -> *). MonadGet m => m Typing
getTyping
Word8
x -> [Char] -> Word8 -> m (TermEdit' LocalTextId LocalDefnId)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTermEdit" Word8
x
getTyping :: (MonadGet m) => m TermEdit.Typing
getTyping :: forall (m :: * -> *). MonadGet m => m Typing
getTyping =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m Typing) -> m Typing
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> Typing -> m Typing
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Typing
TermEdit.Same
Word8
1 -> Typing -> m Typing
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Typing
TermEdit.Subtype
Word8
2 -> Typing -> m Typing
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Typing
TermEdit.Different
Word8
x -> [Char] -> Word8 -> m Typing
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTyping" Word8
x
getTypeEdit :: (MonadGet m) => m TypeEdit.LocalTypeEdit
getTypeEdit :: forall (m :: * -> *).
MonadGet m =>
m (TypeEdit' LocalTextId LocalDefnId)
getTypeEdit =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (TypeEdit' LocalTextId LocalDefnId))
-> m (TypeEdit' LocalTextId LocalDefnId)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> TypeEdit' LocalTextId LocalDefnId
-> m (TypeEdit' LocalTextId LocalDefnId)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure TypeEdit' LocalTextId LocalDefnId
forall t h. TypeEdit' t h
TypeEdit.Deprecate
Word8
1 -> TypeRef -> TypeEdit' LocalTextId LocalDefnId
forall t h. Reference' t h -> TypeEdit' t h
TypeEdit.Replace (TypeRef -> TypeEdit' LocalTextId LocalDefnId)
-> m TypeRef -> m (TypeEdit' LocalTextId LocalDefnId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
Word8
x -> [Char] -> Word8 -> m (TypeEdit' LocalTextId LocalDefnId)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTypeEdit" Word8
x
getPatchLocalIds :: (MonadGet m) => m PatchFormat.PatchLocalIds
getPatchLocalIds :: forall (m :: * -> *). MonadGet m => m PatchLocalIds
getPatchLocalIds =
Vector TextId -> Vector HashId -> Vector ObjectId -> PatchLocalIds
forall t h d.
Vector t -> Vector h -> Vector d -> PatchLocalIds' t h d
PatchFormat.LocalIds
(Vector TextId
-> Vector HashId -> Vector ObjectId -> PatchLocalIds)
-> m (Vector TextId)
-> m (Vector HashId -> Vector ObjectId -> PatchLocalIds)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TextId -> m (Vector TextId)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m TextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
m (Vector HashId -> Vector ObjectId -> PatchLocalIds)
-> m (Vector HashId) -> m (Vector ObjectId -> PatchLocalIds)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m HashId -> m (Vector HashId)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m HashId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
m (Vector ObjectId -> PatchLocalIds)
-> m (Vector ObjectId) -> m PatchLocalIds
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ObjectId -> m (Vector ObjectId)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m ObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
putLocalPatch :: (MonadPut m) => PatchFull.LocalPatch -> m ()
putLocalPatch :: forall (m :: * -> *). MonadPut m => LocalPatch -> m ()
putLocalPatch (PatchFull.Patch Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
termEdits Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
typeEdits) = do
(Referent'' LocalTextId LocalHashId -> m ())
-> (Set (TermEdit' LocalTextId LocalDefnId) -> m ())
-> Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Referent'' LocalTextId LocalHashId -> m ()
forall (m :: * -> *) t1 h1 t2 h2.
(MonadPut m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
Referent' (Reference' t1 h1) (Reference' t2 h2) -> m ()
putReferent ((TermEdit' LocalTextId LocalDefnId -> m ())
-> Set (TermEdit' LocalTextId LocalDefnId) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TermEdit' LocalTextId LocalDefnId -> m ()
forall (m :: * -> *).
MonadPut m =>
TermEdit' LocalTextId LocalDefnId -> m ()
putTermEdit) Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
termEdits
(Reference' LocalTextId LocalHashId -> m ())
-> (Set (TypeEdit' LocalTextId LocalDefnId) -> m ())
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Reference' LocalTextId LocalHashId -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference ((TypeEdit' LocalTextId LocalDefnId -> m ())
-> Set (TypeEdit' LocalTextId LocalDefnId) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TypeEdit' LocalTextId LocalDefnId -> m ()
forall (m :: * -> *).
MonadPut m =>
TypeEdit' LocalTextId LocalDefnId -> m ()
putTypeEdit) Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
typeEdits
putPatchDiff :: (MonadPut m) => PatchDiff.LocalPatchDiff -> m ()
putPatchDiff :: forall (m :: * -> *). MonadPut m => LocalPatchDiff -> m ()
putPatchDiff (PatchDiff.PatchDiff Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
atm Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
atp Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
rtm Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
rtp) = do
(Referent'' LocalTextId LocalHashId -> m ())
-> (Set (TermEdit' LocalTextId LocalDefnId) -> m ())
-> Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Referent'' LocalTextId LocalHashId -> m ()
forall (m :: * -> *) t1 h1 t2 h2.
(MonadPut m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
Referent' (Reference' t1 h1) (Reference' t2 h2) -> m ()
putReferent ((TermEdit' LocalTextId LocalDefnId -> m ())
-> Set (TermEdit' LocalTextId LocalDefnId) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TermEdit' LocalTextId LocalDefnId -> m ()
forall (m :: * -> *).
MonadPut m =>
TermEdit' LocalTextId LocalDefnId -> m ()
putTermEdit) Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
atm
(Reference' LocalTextId LocalHashId -> m ())
-> (Set (TypeEdit' LocalTextId LocalDefnId) -> m ())
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Reference' LocalTextId LocalHashId -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference ((TypeEdit' LocalTextId LocalDefnId -> m ())
-> Set (TypeEdit' LocalTextId LocalDefnId) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TypeEdit' LocalTextId LocalDefnId -> m ()
forall (m :: * -> *).
MonadPut m =>
TypeEdit' LocalTextId LocalDefnId -> m ()
putTypeEdit) Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
atp
(Referent'' LocalTextId LocalHashId -> m ())
-> (Set (TermEdit' LocalTextId LocalDefnId) -> m ())
-> Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Referent'' LocalTextId LocalHashId -> m ()
forall (m :: * -> *) t1 h1 t2 h2.
(MonadPut m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
Referent' (Reference' t1 h1) (Reference' t2 h2) -> m ()
putReferent ((TermEdit' LocalTextId LocalDefnId -> m ())
-> Set (TermEdit' LocalTextId LocalDefnId) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TermEdit' LocalTextId LocalDefnId -> m ()
forall (m :: * -> *).
MonadPut m =>
TermEdit' LocalTextId LocalDefnId -> m ()
putTermEdit) Map
(Referent'' LocalTextId LocalHashId)
(Set (TermEdit' LocalTextId LocalDefnId))
rtm
(Reference' LocalTextId LocalHashId -> m ())
-> (Set (TypeEdit' LocalTextId LocalDefnId) -> m ())
-> Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
-> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> Map a b -> m ()
putMap Reference' LocalTextId LocalHashId -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference ((TypeEdit' LocalTextId LocalDefnId -> m ())
-> Set (TypeEdit' LocalTextId LocalDefnId) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TypeEdit' LocalTextId LocalDefnId -> m ()
forall (m :: * -> *).
MonadPut m =>
TypeEdit' LocalTextId LocalDefnId -> m ()
putTypeEdit) Map
(Reference' LocalTextId LocalHashId)
(Set (TypeEdit' LocalTextId LocalDefnId))
rtp
putPatchLocalIds :: (MonadPut m) => PatchFormat.PatchLocalIds -> m ()
putPatchLocalIds :: forall (m :: * -> *). MonadPut m => PatchLocalIds -> m ()
putPatchLocalIds (PatchFormat.LocalIds Vector TextId
ts Vector HashId
hs Vector ObjectId
os) = do
(TextId -> m ()) -> Vector TextId -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable TextId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Vector TextId
ts
(HashId -> m ()) -> Vector HashId -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable HashId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Vector HashId
hs
(ObjectId -> m ()) -> Vector ObjectId -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable ObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Vector ObjectId
os
putTermEdit :: (MonadPut m) => TermEdit.LocalTermEdit -> m ()
putTermEdit :: forall (m :: * -> *).
MonadPut m =>
TermEdit' LocalTextId LocalDefnId -> m ()
putTermEdit TermEdit' LocalTextId LocalDefnId
TermEdit.Deprecate = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
putTermEdit (TermEdit.Replace Referent'' LocalTextId LocalDefnId
r Typing
t) = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Referent'' LocalTextId LocalDefnId -> m ()
forall (m :: * -> *) t1 h1 t2 h2.
(MonadPut m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
Referent' (Reference' t1 h1) (Reference' t2 h2) -> m ()
putReferent Referent'' LocalTextId LocalDefnId
r m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Typing -> m ()
forall {m :: * -> *}. MonadPut m => Typing -> m ()
putTyping Typing
t
where
putTyping :: Typing -> m ()
putTyping Typing
TermEdit.Same = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
putTyping Typing
TermEdit.Subtype = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1
putTyping Typing
TermEdit.Different = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
2
putTypeEdit :: (MonadPut m) => TypeEdit.LocalTypeEdit -> m ()
putTypeEdit :: forall (m :: * -> *).
MonadPut m =>
TypeEdit' LocalTextId LocalDefnId -> m ()
putTypeEdit TypeEdit' LocalTextId LocalDefnId
TypeEdit.Deprecate = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
putTypeEdit (TypeEdit.Replace TypeRef
r) = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference TypeRef
r
getBranchFormat :: (MonadGet m) => m BranchFormat.BranchFormat
getBranchFormat :: forall (m :: * -> *). MonadGet m => m BranchFormat
getBranchFormat = m BranchFormat -> m BranchFormat -> m BranchFormat
forall text defRef patchRef childRef branchRef (m :: * -> *).
MonadGet m =>
m (BranchFormat' text defRef patchRef childRef branchRef)
-> m (BranchFormat' text defRef patchRef childRef branchRef)
-> m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchFormat' m BranchFormat
forall {branchRef}.
m (BranchFormat'
TextId
ObjectId
PatchObjectId
(BranchObjectId, CausalHashId)
branchRef)
getBranchFull m BranchFormat
getBranchDiff
where
getBranchFull :: m (BranchFormat'
TextId
ObjectId
PatchObjectId
(BranchObjectId, CausalHashId)
branchRef)
getBranchFull = m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
-> m (BranchFormat'
TextId
ObjectId
PatchObjectId
(BranchObjectId, CausalHashId)
branchRef)
forall text defRef patchRef childRef branchRef (m :: * -> *).
MonadGet m =>
m (BranchLocalIds' text defRef patchRef childRef)
-> m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchFull' m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
forall (m :: * -> *).
MonadGet m =>
m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
getBranchLocalIds
getBranchDiff :: m BranchFormat
getBranchDiff = m BranchObjectId
-> m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
-> m BranchFormat
forall (m :: * -> *) branchRef text defRef patchRef childRef.
MonadGet m =>
m branchRef
-> m (BranchLocalIds' text defRef patchRef childRef)
-> m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchDiff' m BranchObjectId
getBranchRef m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
forall (m :: * -> *).
MonadGet m =>
m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
getBranchLocalIds
getBranchRef :: m BranchObjectId
getBranchRef = m BranchObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
getBranchFormat' ::
forall text defRef patchRef childRef branchRef m.
(MonadGet m) =>
m (BranchFormat.BranchFormat' text defRef patchRef childRef branchRef) ->
m (BranchFormat.BranchFormat' text defRef patchRef childRef branchRef) ->
m (BranchFormat.BranchFormat' text defRef patchRef childRef branchRef)
getBranchFormat' :: forall text defRef patchRef childRef branchRef (m :: * -> *).
MonadGet m =>
m (BranchFormat' text defRef patchRef childRef branchRef)
-> m (BranchFormat' text defRef patchRef childRef branchRef)
-> m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchFormat' m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchFull m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchDiff =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8
-> m (BranchFormat' text defRef patchRef childRef branchRef))
-> m (BranchFormat' text defRef patchRef childRef branchRef)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchFull
Word8
1 -> m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchDiff
Word8
x -> [Char]
-> Word8
-> m (BranchFormat' text defRef patchRef childRef branchRef)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getBranchFormat" Word8
x
getBranchFull' ::
forall text defRef patchRef childRef branchRef m.
(MonadGet m) =>
m (BranchFormat.BranchLocalIds' text defRef patchRef childRef) ->
m (BranchFormat.BranchFormat' text defRef patchRef childRef branchRef)
getBranchFull' :: forall text defRef patchRef childRef branchRef (m :: * -> *).
MonadGet m =>
m (BranchLocalIds' text defRef patchRef childRef)
-> m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchFull' m (BranchLocalIds' text defRef patchRef childRef)
getBranchLocalIds =
BranchLocalIds' text defRef patchRef childRef
-> LocalBranch
-> BranchFormat' text defRef patchRef childRef branchRef
forall text defRef patchRef childRef branchRef.
BranchLocalIds' text defRef patchRef childRef
-> LocalBranch
-> BranchFormat' text defRef patchRef childRef branchRef
BranchFormat.Full (BranchLocalIds' text defRef patchRef childRef
-> LocalBranch
-> BranchFormat' text defRef patchRef childRef branchRef)
-> m (BranchLocalIds' text defRef patchRef childRef)
-> m (LocalBranch
-> BranchFormat' text defRef patchRef childRef branchRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (BranchLocalIds' text defRef patchRef childRef)
getBranchLocalIds m (LocalBranch
-> BranchFormat' text defRef patchRef childRef branchRef)
-> m LocalBranch
-> m (BranchFormat' text defRef patchRef childRef branchRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalBranch
forall (m :: * -> *). MonadGet m => m LocalBranch
getLocalBranch
getLocalBranch :: (MonadGet m) => m BranchFull.LocalBranch
getLocalBranch :: forall (m :: * -> *). MonadGet m => m LocalBranch
getLocalBranch =
Map
LocalTextId
(Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId))
-> Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
-> Map LocalTextId LocalPatchObjectId
-> Map LocalTextId LocalBranchChildId
-> LocalBranch
forall t h p c.
Map t (Map (Referent'' t h) (MetadataSetFormat' t h))
-> Map t (Map (TypeReference' t h) (MetadataSetFormat' t h))
-> Map t p
-> Map t c
-> Branch' t h p c
BranchFull.Branch
(Map
LocalTextId
(Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId))
-> Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
-> Map LocalTextId LocalPatchObjectId
-> Map LocalTextId LocalBranchChildId
-> LocalBranch)
-> m (Map
LocalTextId
(Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId)))
-> m (Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
-> Map LocalTextId LocalPatchObjectId
-> Map LocalTextId LocalBranchChildId
-> LocalBranch)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m LocalTextId
-> m (Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId))
-> m (Map
LocalTextId
(Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt (m (Referent'' LocalTextId LocalDefnId)
-> m (MetadataSetFormat' LocalTextId LocalDefnId)
-> m (Map
(Referent'' LocalTextId LocalDefnId)
(MetadataSetFormat' LocalTextId LocalDefnId))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m (Referent'' LocalTextId LocalDefnId)
forall (m :: * -> *) t1 h1 t2 h2.
(MonadGet m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
m (Referent' (Reference' t1 h1) (Reference' t2 h2))
getReferent m (MetadataSetFormat' LocalTextId LocalDefnId)
forall (m :: * -> *).
MonadGet m =>
m (MetadataSetFormat' LocalTextId LocalDefnId)
getMetadataSetFormat)
m (Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
-> Map LocalTextId LocalPatchObjectId
-> Map LocalTextId LocalBranchChildId
-> LocalBranch)
-> m (Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId)))
-> m (Map LocalTextId LocalPatchObjectId
-> Map LocalTextId LocalBranchChildId -> LocalBranch)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalTextId
-> m (Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
-> m (Map
LocalTextId
(Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt (m TypeRef
-> m (MetadataSetFormat' LocalTextId LocalDefnId)
-> m (Map TypeRef (MetadataSetFormat' LocalTextId LocalDefnId))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference m (MetadataSetFormat' LocalTextId LocalDefnId)
forall (m :: * -> *).
MonadGet m =>
m (MetadataSetFormat' LocalTextId LocalDefnId)
getMetadataSetFormat)
m (Map LocalTextId LocalPatchObjectId
-> Map LocalTextId LocalBranchChildId -> LocalBranch)
-> m (Map LocalTextId LocalPatchObjectId)
-> m (Map LocalTextId LocalBranchChildId -> LocalBranch)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalTextId
-> m LocalPatchObjectId -> m (Map LocalTextId LocalPatchObjectId)
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m LocalPatchObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
m (Map LocalTextId LocalBranchChildId -> LocalBranch)
-> m (Map LocalTextId LocalBranchChildId) -> m LocalBranch
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalTextId
-> m LocalBranchChildId -> m (Map LocalTextId LocalBranchChildId)
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m LocalBranchChildId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
where
getMetadataSetFormat :: (MonadGet m) => m BranchFull.LocalMetadataSet
getMetadataSetFormat :: forall (m :: * -> *).
MonadGet m =>
m (MetadataSetFormat' LocalTextId LocalDefnId)
getMetadataSetFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (MetadataSetFormat' LocalTextId LocalDefnId))
-> m (MetadataSetFormat' LocalTextId LocalDefnId)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> Set TypeRef -> MetadataSetFormat' LocalTextId LocalDefnId
forall t h. Set (Reference' t h) -> MetadataSetFormat' t h
BranchFull.Inline (Set TypeRef -> MetadataSetFormat' LocalTextId LocalDefnId)
-> m (Set TypeRef)
-> m (MetadataSetFormat' LocalTextId LocalDefnId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef -> m (Set TypeRef)
forall (m :: * -> *) a. (MonadGet m, Ord a) => m a -> m (Set a)
getSet m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
Word8
x -> [Char] -> Word8 -> m (MetadataSetFormat' LocalTextId LocalDefnId)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getMetadataSetFormat" Word8
x
getBranchDiff' ::
(MonadGet m) =>
m branchRef ->
m (BranchFormat.BranchLocalIds' text defRef patchRef childRef) ->
m (BranchFormat.BranchFormat' text defRef patchRef childRef branchRef)
getBranchDiff' :: forall (m :: * -> *) branchRef text defRef patchRef childRef.
MonadGet m =>
m branchRef
-> m (BranchLocalIds' text defRef patchRef childRef)
-> m (BranchFormat' text defRef patchRef childRef branchRef)
getBranchDiff' m branchRef
getBranchRef m (BranchLocalIds' text defRef patchRef childRef)
getBranchLocalIds =
branchRef
-> BranchLocalIds' text defRef patchRef childRef
-> LocalDiff
-> BranchFormat' text defRef patchRef childRef branchRef
forall text defRef patchRef childRef branchRef.
branchRef
-> BranchLocalIds' text defRef patchRef childRef
-> LocalDiff
-> BranchFormat' text defRef patchRef childRef branchRef
BranchFormat.Diff
(branchRef
-> BranchLocalIds' text defRef patchRef childRef
-> LocalDiff
-> BranchFormat' text defRef patchRef childRef branchRef)
-> m branchRef
-> m (BranchLocalIds' text defRef patchRef childRef
-> LocalDiff
-> BranchFormat' text defRef patchRef childRef branchRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m branchRef
getBranchRef
m (BranchLocalIds' text defRef patchRef childRef
-> LocalDiff
-> BranchFormat' text defRef patchRef childRef branchRef)
-> m (BranchLocalIds' text defRef patchRef childRef)
-> m (LocalDiff
-> BranchFormat' text defRef patchRef childRef branchRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (BranchLocalIds' text defRef patchRef childRef)
getBranchLocalIds
m (LocalDiff
-> BranchFormat' text defRef patchRef childRef branchRef)
-> m LocalDiff
-> m (BranchFormat' text defRef patchRef childRef branchRef)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalDiff
forall (m :: * -> *). MonadGet m => m LocalDiff
getLocalBranchDiff
getLocalBranchDiff :: (MonadGet m) => m BranchDiff.LocalDiff
getLocalBranchDiff :: forall (m :: * -> *). MonadGet m => m LocalDiff
getLocalBranchDiff =
Map
LocalTextId
(Map (Referent'' LocalTextId LocalDefnId) (DefinitionOp' TypeRef))
-> Map LocalTextId (Map TypeRef (DefinitionOp' TypeRef))
-> Map LocalTextId (PatchOp' LocalPatchObjectId)
-> Map LocalTextId (ChildOp' LocalBranchChildId)
-> LocalDiff
forall t h p c.
Map t (Map (Referent'' t h) (DefinitionOp' (Metadata t h)))
-> Map t (Map (Metadata t h) (DefinitionOp' (Metadata t h)))
-> Map t (PatchOp' p)
-> Map t (ChildOp' c)
-> Diff' t h p c
BranchDiff.Diff
(Map
LocalTextId
(Map (Referent'' LocalTextId LocalDefnId) (DefinitionOp' TypeRef))
-> Map LocalTextId (Map TypeRef (DefinitionOp' TypeRef))
-> Map LocalTextId (PatchOp' LocalPatchObjectId)
-> Map LocalTextId (ChildOp' LocalBranchChildId)
-> LocalDiff)
-> m (Map
LocalTextId
(Map (Referent'' LocalTextId LocalDefnId) (DefinitionOp' TypeRef)))
-> m (Map LocalTextId (Map TypeRef (DefinitionOp' TypeRef))
-> Map LocalTextId (PatchOp' LocalPatchObjectId)
-> Map LocalTextId (ChildOp' LocalBranchChildId)
-> LocalDiff)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m LocalTextId
-> m (Map
(Referent'' LocalTextId LocalDefnId) (DefinitionOp' TypeRef))
-> m (Map
LocalTextId
(Map (Referent'' LocalTextId LocalDefnId) (DefinitionOp' TypeRef)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt (m (Referent'' LocalTextId LocalDefnId)
-> m (DefinitionOp' TypeRef)
-> m (Map
(Referent'' LocalTextId LocalDefnId) (DefinitionOp' TypeRef))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m (Referent'' LocalTextId LocalDefnId)
forall (m :: * -> *) t1 h1 t2 h2.
(MonadGet m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
m (Referent' (Reference' t1 h1) (Reference' t2 h2))
getReferent m (DefinitionOp' TypeRef)
forall (m :: * -> *). MonadGet m => m (DefinitionOp' TypeRef)
getDiffOp)
m (Map LocalTextId (Map TypeRef (DefinitionOp' TypeRef))
-> Map LocalTextId (PatchOp' LocalPatchObjectId)
-> Map LocalTextId (ChildOp' LocalBranchChildId)
-> LocalDiff)
-> m (Map LocalTextId (Map TypeRef (DefinitionOp' TypeRef)))
-> m (Map LocalTextId (PatchOp' LocalPatchObjectId)
-> Map LocalTextId (ChildOp' LocalBranchChildId) -> LocalDiff)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalTextId
-> m (Map TypeRef (DefinitionOp' TypeRef))
-> m (Map LocalTextId (Map TypeRef (DefinitionOp' TypeRef)))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt (m TypeRef
-> m (DefinitionOp' TypeRef)
-> m (Map TypeRef (DefinitionOp' TypeRef))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference m (DefinitionOp' TypeRef)
forall (m :: * -> *). MonadGet m => m (DefinitionOp' TypeRef)
getDiffOp)
m (Map LocalTextId (PatchOp' LocalPatchObjectId)
-> Map LocalTextId (ChildOp' LocalBranchChildId) -> LocalDiff)
-> m (Map LocalTextId (PatchOp' LocalPatchObjectId))
-> m (Map LocalTextId (ChildOp' LocalBranchChildId) -> LocalDiff)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalTextId
-> m (PatchOp' LocalPatchObjectId)
-> m (Map LocalTextId (PatchOp' LocalPatchObjectId))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m (PatchOp' LocalPatchObjectId)
forall (m :: * -> *). MonadGet m => m (PatchOp' LocalPatchObjectId)
getPatchOp
m (Map LocalTextId (ChildOp' LocalBranchChildId) -> LocalDiff)
-> m (Map LocalTextId (ChildOp' LocalBranchChildId)) -> m LocalDiff
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m LocalTextId
-> m (ChildOp' LocalBranchChildId)
-> m (Map LocalTextId (ChildOp' LocalBranchChildId))
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m LocalTextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m (ChildOp' LocalBranchChildId)
forall (m :: * -> *). MonadGet m => m (ChildOp' LocalBranchChildId)
getChildOp
where
getDiffOp :: (MonadGet m) => m BranchDiff.LocalDefinitionOp
getDiffOp :: forall (m :: * -> *). MonadGet m => m (DefinitionOp' TypeRef)
getDiffOp =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (DefinitionOp' TypeRef))
-> m (DefinitionOp' TypeRef)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> DefinitionOp' TypeRef -> m (DefinitionOp' TypeRef)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure DefinitionOp' TypeRef
forall r. DefinitionOp' r
BranchDiff.RemoveDef
Word8
1 -> Set TypeRef -> DefinitionOp' TypeRef
forall r. Set r -> DefinitionOp' r
BranchDiff.AddDefWithMetadata (Set TypeRef -> DefinitionOp' TypeRef)
-> m (Set TypeRef) -> m (DefinitionOp' TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef -> m (Set TypeRef)
forall (m :: * -> *) a. (MonadGet m, Ord a) => m a -> m (Set a)
getSet m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
Word8
2 -> AddRemove TypeRef -> DefinitionOp' TypeRef
forall r. AddRemove r -> DefinitionOp' r
BranchDiff.AlterDefMetadata (AddRemove TypeRef -> DefinitionOp' TypeRef)
-> m (AddRemove TypeRef) -> m (DefinitionOp' TypeRef)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TypeRef -> m (AddRemove TypeRef)
forall {m :: * -> *} {a}.
(MonadGet m, Ord a) =>
m a -> m (Map a Bool)
getAddRemove m TypeRef
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
Word8
x -> [Char] -> Word8 -> m (DefinitionOp' TypeRef)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getDiffOp" Word8
x
getAddRemove :: m a -> m (Map a Bool)
getAddRemove m a
get = do
Map a Bool
adds <- m a -> m Bool -> m (Map a Bool)
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> m (Map a b)
getMap m a
get (Bool -> m Bool
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
True)
m a -> m Bool -> Map a Bool -> m (Map a Bool)
forall (m :: * -> *) a b.
(MonadGet m, Ord a) =>
m a -> m b -> Map a b -> m (Map a b)
addToExistingMap m a
get (Bool -> m Bool
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False) Map a Bool
adds
getPatchOp :: (MonadGet m) => m BranchDiff.LocalPatchOp
getPatchOp :: forall (m :: * -> *). MonadGet m => m (PatchOp' LocalPatchObjectId)
getPatchOp =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (PatchOp' LocalPatchObjectId))
-> m (PatchOp' LocalPatchObjectId)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> PatchOp' LocalPatchObjectId -> m (PatchOp' LocalPatchObjectId)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure PatchOp' LocalPatchObjectId
forall p. PatchOp' p
BranchDiff.PatchRemove
Word8
1 -> LocalPatchObjectId -> PatchOp' LocalPatchObjectId
forall p. p -> PatchOp' p
BranchDiff.PatchAddReplace (LocalPatchObjectId -> PatchOp' LocalPatchObjectId)
-> m LocalPatchObjectId -> m (PatchOp' LocalPatchObjectId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m LocalPatchObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
x -> [Char] -> Word8 -> m (PatchOp' LocalPatchObjectId)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getPatchOp" Word8
x
getChildOp :: (MonadGet m) => m BranchDiff.LocalChildOp
getChildOp :: forall (m :: * -> *). MonadGet m => m (ChildOp' LocalBranchChildId)
getChildOp =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (ChildOp' LocalBranchChildId))
-> m (ChildOp' LocalBranchChildId)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> ChildOp' LocalBranchChildId -> m (ChildOp' LocalBranchChildId)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ChildOp' LocalBranchChildId
forall c. ChildOp' c
BranchDiff.ChildRemove
Word8
1 -> LocalBranchChildId -> ChildOp' LocalBranchChildId
forall c. c -> ChildOp' c
BranchDiff.ChildAddReplace (LocalBranchChildId -> ChildOp' LocalBranchChildId)
-> m LocalBranchChildId -> m (ChildOp' LocalBranchChildId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m LocalBranchChildId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
x -> [Char] -> Word8 -> m (ChildOp' LocalBranchChildId)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getChildOp" Word8
x
getBranchLocalIds :: (MonadGet m) => m BranchFormat.BranchLocalIds
getBranchLocalIds :: forall (m :: * -> *).
MonadGet m =>
m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
getBranchLocalIds =
Vector TextId
-> Vector ObjectId
-> Vector PatchObjectId
-> Vector (BranchObjectId, CausalHashId)
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
forall t d p c.
Vector t
-> Vector d -> Vector p -> Vector c -> BranchLocalIds' t d p c
BranchFormat.LocalIds
(Vector TextId
-> Vector ObjectId
-> Vector PatchObjectId
-> Vector (BranchObjectId, CausalHashId)
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
-> m (Vector TextId)
-> m (Vector ObjectId
-> Vector PatchObjectId
-> Vector (BranchObjectId, CausalHashId)
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m TextId -> m (Vector TextId)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m TextId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
m (Vector ObjectId
-> Vector PatchObjectId
-> Vector (BranchObjectId, CausalHashId)
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
-> m (Vector ObjectId)
-> m (Vector PatchObjectId
-> Vector (BranchObjectId, CausalHashId)
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ObjectId -> m (Vector ObjectId)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m ObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
m (Vector PatchObjectId
-> Vector (BranchObjectId, CausalHashId)
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
-> m (Vector PatchObjectId)
-> m (Vector (BranchObjectId, CausalHashId)
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m PatchObjectId -> m (Vector PatchObjectId)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m PatchObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
m (Vector (BranchObjectId, CausalHashId)
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
-> m (Vector (BranchObjectId, CausalHashId))
-> m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (BranchObjectId, CausalHashId)
-> m (Vector (BranchObjectId, CausalHashId))
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector (m BranchObjectId
-> m CausalHashId -> m (BranchObjectId, CausalHashId)
forall (m :: * -> *) a b. MonadGet m => m a -> m b -> m (a, b)
getPair m BranchObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m CausalHashId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt)
decomposeTermFormat :: (MonadGet m) => m TermFormat.SyncTermFormat
decomposeTermFormat :: forall (m :: * -> *). MonadGet m => m SyncTermFormat
decomposeTermFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m SyncTermFormat) -> m SyncTermFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 ->
SyncLocallyIndexedComponent' TextId ObjectId -> SyncTermFormat
forall t d. SyncLocallyIndexedComponent' t d -> SyncTermFormat' t d
TermFormat.SyncTerm
(SyncLocallyIndexedComponent' TextId ObjectId -> SyncTermFormat)
-> (Vector (LocalIds' TextId ObjectId, ByteString)
-> SyncLocallyIndexedComponent' TextId ObjectId)
-> Vector (LocalIds' TextId ObjectId, ByteString)
-> SyncTermFormat
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector (LocalIds' TextId ObjectId, ByteString)
-> SyncLocallyIndexedComponent' TextId ObjectId
forall t d.
Vector (LocalIds' t d, ByteString)
-> SyncLocallyIndexedComponent' t d
TermFormat.SyncLocallyIndexedComponent
(Vector (LocalIds' TextId ObjectId, ByteString) -> SyncTermFormat)
-> m (Vector (LocalIds' TextId ObjectId, ByteString))
-> m SyncTermFormat
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Vector (LocalIds' TextId ObjectId, ByteString))
forall (m :: * -> *).
MonadGet m =>
m (Vector (LocalIds' TextId ObjectId, ByteString))
decomposeComponent
Word8
tag -> [Char] -> m SyncTermFormat
forall a. HasCallStack => [Char] -> a
error ([Char] -> m SyncTermFormat) -> [Char] -> m SyncTermFormat
forall a b. (a -> b) -> a -> b
$ [Char]
"todo: unknown term format tag " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Word8 -> [Char]
forall a. Show a => a -> [Char]
show Word8
tag
decomposeDeclFormat :: (MonadGet m) => m DeclFormat.SyncDeclFormat
decomposeDeclFormat :: forall (m :: * -> *). MonadGet m => m SyncDeclFormat
decomposeDeclFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m SyncDeclFormat) -> m SyncDeclFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 ->
SyncLocallyIndexedComponent' TextId ObjectId -> SyncDeclFormat
forall t d. SyncLocallyIndexedComponent' t d -> SyncDeclFormat' t d
DeclFormat.SyncDecl
(SyncLocallyIndexedComponent' TextId ObjectId -> SyncDeclFormat)
-> (Vector (LocalIds' TextId ObjectId, ByteString)
-> SyncLocallyIndexedComponent' TextId ObjectId)
-> Vector (LocalIds' TextId ObjectId, ByteString)
-> SyncDeclFormat
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector (LocalIds' TextId ObjectId, ByteString)
-> SyncLocallyIndexedComponent' TextId ObjectId
forall t d.
Vector (LocalIds' t d, ByteString)
-> SyncLocallyIndexedComponent' t d
DeclFormat.SyncLocallyIndexedComponent
(Vector (LocalIds' TextId ObjectId, ByteString) -> SyncDeclFormat)
-> m (Vector (LocalIds' TextId ObjectId, ByteString))
-> m SyncDeclFormat
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (Vector (LocalIds' TextId ObjectId, ByteString))
forall (m :: * -> *).
MonadGet m =>
m (Vector (LocalIds' TextId ObjectId, ByteString))
decomposeComponent
Word8
tag -> [Char] -> m SyncDeclFormat
forall a. HasCallStack => [Char] -> a
error ([Char] -> m SyncDeclFormat) -> [Char] -> m SyncDeclFormat
forall a b. (a -> b) -> a -> b
$ [Char]
"todo: unknown term format tag " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Word8 -> [Char]
forall a. Show a => a -> [Char]
show Word8
tag
decomposeComponent :: (MonadGet m) => m (Vector (LocalIds, BS.ByteString))
decomposeComponent :: forall (m :: * -> *).
MonadGet m =>
m (Vector (LocalIds' TextId ObjectId, ByteString))
decomposeComponent = do
[Int]
offsets <- m Int -> m [Int]
forall (m :: * -> *) a. MonadGet m => m a -> m [a]
getList (forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt @_ @Int)
ByteString
componentBytes <- Int -> m ByteString
forall (m :: * -> *). MonadGet m => Int -> m ByteString
getByteString ([Int] -> Int
forall a. HasCallStack => [a] -> a
last [Int]
offsets)
let get1 :: (Int, Int) -> m (Vector (LocalIds' TextId ObjectId, ByteString))
get1 (Int
start, Int
end) = do
let bytes :: ByteString
bytes = Int -> ByteString -> ByteString
BS.drop Int
start (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
$ Int -> ByteString -> ByteString
BS.take Int
end ByteString
componentBytes
([Char] -> m (Vector (LocalIds' TextId ObjectId, ByteString)))
-> ((LocalIds' TextId ObjectId, ByteString)
-> m (Vector (LocalIds' TextId ObjectId, ByteString)))
-> Either [Char] (LocalIds' TextId ObjectId, ByteString)
-> m (Vector (LocalIds' TextId ObjectId, ByteString))
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either [Char] -> m (Vector (LocalIds' TextId ObjectId, ByteString))
forall a. [Char] -> m a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
fail (Vector (LocalIds' TextId ObjectId, ByteString)
-> m (Vector (LocalIds' TextId ObjectId, ByteString))
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Vector (LocalIds' TextId ObjectId, ByteString)
-> m (Vector (LocalIds' TextId ObjectId, ByteString)))
-> ((LocalIds' TextId ObjectId, ByteString)
-> Vector (LocalIds' TextId ObjectId, ByteString))
-> (LocalIds' TextId ObjectId, ByteString)
-> m (Vector (LocalIds' TextId ObjectId, ByteString))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (LocalIds' TextId ObjectId, ByteString)
-> Vector (LocalIds' TextId ObjectId, ByteString)
forall a. a -> Vector a
forall (f :: * -> *) a. Applicative f => a -> f a
pure) (Either [Char] (LocalIds' TextId ObjectId, ByteString)
-> m (Vector (LocalIds' TextId ObjectId, ByteString)))
-> Either [Char] (LocalIds' TextId ObjectId, ByteString)
-> m (Vector (LocalIds' TextId ObjectId, ByteString))
forall a b. (a -> b) -> a -> b
$ Get (LocalIds' TextId ObjectId, ByteString)
-> ByteString
-> Either [Char] (LocalIds' TextId ObjectId, ByteString)
forall a. Get a -> ByteString -> Either [Char] a
runGetS Get (LocalIds' TextId ObjectId, ByteString)
split ByteString
bytes
split :: Get (LocalIds' TextId ObjectId, ByteString)
split = (,) (LocalIds' TextId ObjectId
-> ByteString -> (LocalIds' TextId ObjectId, ByteString))
-> Get (LocalIds' TextId ObjectId)
-> Get (ByteString -> (LocalIds' TextId ObjectId, ByteString))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Get (LocalIds' TextId ObjectId)
forall (m :: * -> *) t h.
(MonadGet m, Num t, Bits t, Num h, Bits h) =>
m (LocalIds' t h)
getLocalIds Get (ByteString -> (LocalIds' TextId ObjectId, ByteString))
-> Get ByteString -> Get (LocalIds' TextId ObjectId, ByteString)
forall a b. Get (a -> b) -> Get a -> Get b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Get ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getRemainingByteString
((Int, Int) -> m (Vector (LocalIds' TextId ObjectId, ByteString)))
-> [(Int, Int)]
-> m (Vector (LocalIds' TextId ObjectId, ByteString))
forall (m :: * -> *) (f :: * -> *) b a.
(Monad m, Foldable f, Monoid b) =>
(a -> m b) -> f a -> m b
Monoid.foldMapM (Int, Int) -> m (Vector (LocalIds' TextId ObjectId, ByteString))
get1 ([Int] -> [Int] -> [(Int, Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [Int]
offsets ([Int] -> [Int]
forall a. HasCallStack => [a] -> [a]
tail [Int]
offsets))
recomposeTermFormat :: (MonadPut m) => TermFormat.SyncTermFormat -> m ()
recomposeTermFormat :: forall (m :: * -> *). MonadPut m => SyncTermFormat -> m ()
recomposeTermFormat = \case
TermFormat.SyncTerm (TermFormat.SyncLocallyIndexedComponent Vector (LocalIds' TextId ObjectId, ByteString)
x) ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Vector (LocalIds' TextId ObjectId, ByteString) -> m ()
forall (m :: * -> *).
MonadPut m =>
Vector (LocalIds' TextId ObjectId, ByteString) -> m ()
recomposeComponent Vector (LocalIds' TextId ObjectId, ByteString)
x
recomposeDeclFormat :: (MonadPut m) => DeclFormat.SyncDeclFormat -> m ()
recomposeDeclFormat :: forall (m :: * -> *). MonadPut m => SyncDeclFormat -> m ()
recomposeDeclFormat = \case
DeclFormat.SyncDecl (DeclFormat.SyncLocallyIndexedComponent Vector (LocalIds' TextId ObjectId, ByteString)
x) ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Vector (LocalIds' TextId ObjectId, ByteString) -> m ()
forall (m :: * -> *).
MonadPut m =>
Vector (LocalIds' TextId ObjectId, ByteString) -> m ()
recomposeComponent Vector (LocalIds' TextId ObjectId, ByteString)
x
recomposeComponent :: (MonadPut m) => Vector (LocalIds, BS.ByteString) -> m ()
recomposeComponent :: forall (m :: * -> *).
MonadPut m =>
Vector (LocalIds' TextId ObjectId, ByteString) -> m ()
recomposeComponent = Put (LocalIds' TextId ObjectId, ByteString)
-> Vector (LocalIds' TextId ObjectId, ByteString) -> m ()
forall (m :: * -> *) (f :: * -> *) a.
(MonadPut m, Foldable f) =>
Put a -> f a -> m ()
putFramedArray \(LocalIds' TextId ObjectId
localIds, ByteString
bytes) -> do
LocalIds' TextId ObjectId -> m ()
forall (m :: * -> *) t d.
(MonadPut m, Integral t, Bits t, Integral d, Bits d) =>
LocalIds' t d -> m ()
putLocalIds LocalIds' TextId ObjectId
localIds
ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putByteString ByteString
bytes
decomposeWatchFormat :: (MonadGet m) => m TermFormat.SyncWatchResultFormat
decomposeWatchFormat :: forall (m :: * -> *). MonadGet m => m SyncWatchResultFormat
decomposeWatchFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m SyncWatchResultFormat) -> m SyncWatchResultFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> WatchLocalIds -> ByteString -> SyncWatchResultFormat
TermFormat.SyncWatchResult (WatchLocalIds -> ByteString -> SyncWatchResultFormat)
-> m WatchLocalIds -> m (ByteString -> SyncWatchResultFormat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m WatchLocalIds
forall (m :: * -> *). MonadGet m => m WatchLocalIds
getWatchLocalIds m (ByteString -> SyncWatchResultFormat)
-> m ByteString -> m SyncWatchResultFormat
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getRemainingByteString
Word8
x -> [Char] -> Word8 -> m SyncWatchResultFormat
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"decomposeWatchFormat" Word8
x
recomposeWatchFormat :: (MonadPut m) => TermFormat.SyncWatchResultFormat -> m ()
recomposeWatchFormat :: forall (m :: * -> *). MonadPut m => SyncWatchResultFormat -> m ()
recomposeWatchFormat (TermFormat.SyncWatchResult WatchLocalIds
wli ByteString
bs) =
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> WatchLocalIds -> m ()
forall (m :: * -> *) t d.
(MonadPut m, Integral t, Bits t, Integral d, Bits d) =>
LocalIds' t d -> m ()
putLocalIds WatchLocalIds
wli m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putByteString ByteString
bs
decomposePatchFormat :: (MonadGet m) => m PatchFormat.SyncPatchFormat
decomposePatchFormat :: forall (m :: * -> *). MonadGet m => m SyncPatchFormat
decomposePatchFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m SyncPatchFormat) -> m SyncPatchFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> PatchLocalIds -> ByteString -> SyncPatchFormat
forall parent text hash defn.
PatchLocalIds' text hash defn
-> ByteString -> SyncPatchFormat' parent text hash defn
PatchFormat.SyncFull (PatchLocalIds -> ByteString -> SyncPatchFormat)
-> m PatchLocalIds -> m (ByteString -> SyncPatchFormat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m PatchLocalIds
forall (m :: * -> *). MonadGet m => m PatchLocalIds
getPatchLocalIds m (ByteString -> SyncPatchFormat)
-> m ByteString -> m SyncPatchFormat
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getRemainingByteString
Word8
1 -> PatchObjectId -> PatchLocalIds -> ByteString -> SyncPatchFormat
forall parent text hash defn.
parent
-> PatchLocalIds' text hash defn
-> ByteString
-> SyncPatchFormat' parent text hash defn
PatchFormat.SyncDiff (PatchObjectId -> PatchLocalIds -> ByteString -> SyncPatchFormat)
-> m PatchObjectId
-> m (PatchLocalIds -> ByteString -> SyncPatchFormat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m PatchObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m (PatchLocalIds -> ByteString -> SyncPatchFormat)
-> m PatchLocalIds -> m (ByteString -> SyncPatchFormat)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m PatchLocalIds
forall (m :: * -> *). MonadGet m => m PatchLocalIds
getPatchLocalIds m (ByteString -> SyncPatchFormat)
-> m ByteString -> m SyncPatchFormat
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getRemainingByteString
Word8
x -> [Char] -> Word8 -> m SyncPatchFormat
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"decomposePatchFormat" Word8
x
recomposePatchFormat :: (MonadPut m) => PatchFormat.SyncPatchFormat -> m ()
recomposePatchFormat :: forall (m :: * -> *). MonadPut m => SyncPatchFormat -> m ()
recomposePatchFormat = \case
PatchFormat.SyncFull PatchLocalIds
li ByteString
bs ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> PatchLocalIds -> m ()
forall (m :: * -> *). MonadPut m => PatchLocalIds -> m ()
putPatchLocalIds PatchLocalIds
li m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putByteString ByteString
bs
PatchFormat.SyncDiff PatchObjectId
id PatchLocalIds
li ByteString
bs ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> PatchObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt PatchObjectId
id m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> PatchLocalIds -> m ()
forall (m :: * -> *). MonadPut m => PatchLocalIds -> m ()
putPatchLocalIds PatchLocalIds
li m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putByteString ByteString
bs
decomposeBranchFormat :: (MonadGet m) => m BranchFormat.SyncBranchFormat
decomposeBranchFormat :: forall (m :: * -> *). MonadGet m => m SyncBranchFormat
decomposeBranchFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m SyncBranchFormat) -> m SyncBranchFormat
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> LocalBranchBytes -> SyncBranchFormat
forall parent text defn patch child.
BranchLocalIds' text defn patch child
-> LocalBranchBytes
-> SyncBranchFormat' parent text defn patch child
BranchFormat.SyncFull (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> LocalBranchBytes -> SyncBranchFormat)
-> m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
-> m (LocalBranchBytes -> SyncBranchFormat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
forall (m :: * -> *).
MonadGet m =>
m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
getBranchLocalIds m (LocalBranchBytes -> SyncBranchFormat)
-> m LocalBranchBytes -> m SyncBranchFormat
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ByteString -> LocalBranchBytes
BranchFormat.LocalBranchBytes (ByteString -> LocalBranchBytes)
-> m ByteString -> m LocalBranchBytes
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getRemainingByteString)
Word8
1 -> BranchObjectId
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> LocalBranchBytes
-> SyncBranchFormat
forall parent text defn patch child.
parent
-> BranchLocalIds' text defn patch child
-> LocalBranchBytes
-> SyncBranchFormat' parent text defn patch child
BranchFormat.SyncDiff (BranchObjectId
-> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> LocalBranchBytes
-> SyncBranchFormat)
-> m BranchObjectId
-> m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> LocalBranchBytes -> SyncBranchFormat)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m BranchObjectId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> LocalBranchBytes -> SyncBranchFormat)
-> m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
-> m (LocalBranchBytes -> SyncBranchFormat)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
forall (m :: * -> *).
MonadGet m =>
m (BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId))
getBranchLocalIds m (LocalBranchBytes -> SyncBranchFormat)
-> m LocalBranchBytes -> m SyncBranchFormat
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ByteString -> LocalBranchBytes
BranchFormat.LocalBranchBytes (ByteString -> LocalBranchBytes)
-> m ByteString -> m LocalBranchBytes
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getRemainingByteString)
Word8
x -> [Char] -> Word8 -> m SyncBranchFormat
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"decomposeBranchFormat" Word8
x
recomposeBranchFormat :: (MonadPut m) => BranchFormat.SyncBranchFormat -> m ()
recomposeBranchFormat :: forall (m :: * -> *). MonadPut m => SyncBranchFormat -> m ()
recomposeBranchFormat = \case
BranchFormat.SyncFull BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
li (BranchFormat.LocalBranchBytes ByteString
bs) ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
forall (m :: * -> *).
MonadPut m =>
BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
putBranchLocalIds BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
li m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putByteString ByteString
bs
BranchFormat.SyncDiff BranchObjectId
id BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
li (BranchFormat.LocalBranchBytes ByteString
bs) ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> BranchObjectId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt BranchObjectId
id m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
forall (m :: * -> *).
MonadPut m =>
BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
-> m ()
putBranchLocalIds BranchLocalIds'
TextId ObjectId PatchObjectId (BranchObjectId, CausalHashId)
li m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putByteString ByteString
bs
putTempEntity :: (MonadPut m) => TempEntity -> m ()
putTempEntity :: forall (m :: * -> *). MonadPut m => TempEntity -> m ()
putTempEntity = \case
Entity.TC SyncTermFormat' Text Hash32
tc -> case SyncTermFormat' Text Hash32
tc of
TermFormat.SyncTerm SyncLocallyIndexedComponent' Text Hash32
term ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> SyncLocallyIndexedComponent' Text Hash32 -> m ()
putSyncTerm SyncLocallyIndexedComponent' Text Hash32
term
Entity.DC SyncDeclFormat' Text Hash32
dc -> case SyncDeclFormat' Text Hash32
dc of
DeclFormat.SyncDecl SyncLocallyIndexedComponent' Text Hash32
decl ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> SyncLocallyIndexedComponent' Text Hash32 -> m ()
putSyncDecl SyncLocallyIndexedComponent' Text Hash32
decl
Entity.P SyncPatchFormat' Hash32 Text Hash32 Hash32
p -> case SyncPatchFormat' Hash32 Text Hash32 Hash32
p of
PatchFormat.SyncFull PatchLocalIds' Text Hash32 Hash32
lids ByteString
bytes ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> PatchLocalIds' Text Hash32 Hash32 -> ByteString -> m ()
putSyncFullPatch PatchLocalIds' Text Hash32 Hash32
lids ByteString
bytes
PatchFormat.SyncDiff Hash32
parent PatchLocalIds' Text Hash32 Hash32
lids ByteString
bytes ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Hash32 -> PatchLocalIds' Text Hash32 Hash32 -> ByteString -> m ()
putSyncDiffPatch Hash32
parent PatchLocalIds' Text Hash32 Hash32
lids ByteString
bytes
Entity.N SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32)
n -> case SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32)
n of
BranchFormat.SyncFull BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
lids (BranchFormat.LocalBranchBytes ByteString
bytes) ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> ByteString -> m ()
putSyncFullNamespace BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
lids ByteString
bytes
BranchFormat.SyncDiff Hash32
parent BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
lids (BranchFormat.LocalBranchBytes ByteString
bytes) ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> Hash32
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> ByteString
-> m ()
putSyncDiffNamespace Hash32
parent BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
lids ByteString
bytes
Entity.C SyncCausalFormat' Hash32 Hash32
gdc ->
SyncCausalFormat' Hash32 Hash32 -> m ()
putSyncCausal SyncCausalFormat' Hash32 Hash32
gdc
where
putHash32 :: Hash32 -> m ()
putHash32 = Text -> m ()
forall (m :: * -> *). MonadPut m => Text -> m ()
putText (Text -> m ()) -> (Hash32 -> Text) -> Hash32 -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Hash32 -> Text
Hash32.toText
putPatchLocalIds :: PatchLocalIds' Text Hash32 Hash32 -> m ()
putPatchLocalIds PatchFormat.LocalIds {Vector Text
patchTextLookup :: Vector Text
$sel:patchTextLookup:LocalIds :: forall t h d. PatchLocalIds' t h d -> Vector t
patchTextLookup, Vector Hash32
patchHashLookup :: Vector Hash32
$sel:patchHashLookup:LocalIds :: forall t h d. PatchLocalIds' t h d -> Vector h
patchHashLookup, Vector Hash32
patchDefnLookup :: Vector Hash32
$sel:patchDefnLookup:LocalIds :: forall t h d. PatchLocalIds' t h d -> Vector d
patchDefnLookup} = do
(Text -> m ()) -> Vector Text -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Text -> m ()
forall (m :: * -> *). MonadPut m => Text -> m ()
putText Vector Text
patchTextLookup
(Hash32 -> m ()) -> Vector Hash32 -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Hash32 -> m ()
putHash32 Vector Hash32
patchHashLookup
(Hash32 -> m ()) -> Vector Hash32 -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Hash32 -> m ()
putHash32 Vector Hash32
patchDefnLookup
putNamespaceLocalIds :: BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32) -> m ()
putNamespaceLocalIds BranchFormat.LocalIds {Vector Text
branchTextLookup :: Vector Text
$sel:branchTextLookup:LocalIds :: forall t d p c. BranchLocalIds' t d p c -> Vector t
branchTextLookup, Vector Hash32
branchDefnLookup :: Vector Hash32
$sel:branchDefnLookup:LocalIds :: forall t d p c. BranchLocalIds' t d p c -> Vector d
branchDefnLookup, Vector Hash32
branchPatchLookup :: Vector Hash32
$sel:branchPatchLookup:LocalIds :: forall t d p c. BranchLocalIds' t d p c -> Vector p
branchPatchLookup, Vector (Hash32, Hash32)
branchChildLookup :: Vector (Hash32, Hash32)
$sel:branchChildLookup:LocalIds :: forall t d p c. BranchLocalIds' t d p c -> Vector c
branchChildLookup} = do
(Text -> m ()) -> Vector Text -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Text -> m ()
forall (m :: * -> *). MonadPut m => Text -> m ()
putText Vector Text
branchTextLookup
(Hash32 -> m ()) -> Vector Hash32 -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Hash32 -> m ()
putHash32 Vector Hash32
branchDefnLookup
(Hash32 -> m ()) -> Vector Hash32 -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Hash32 -> m ()
putHash32 Vector Hash32
branchPatchLookup
((Hash32, Hash32) -> m ()) -> Vector (Hash32, Hash32) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable ((Hash32 -> m ()) -> (Hash32 -> m ()) -> (Hash32, Hash32) -> m ()
forall (m :: * -> *) a b.
MonadPut m =>
(a -> m ()) -> (b -> m ()) -> (a, b) -> m ()
putPair Hash32 -> m ()
putHash32 Hash32 -> m ()
putHash32) Vector (Hash32, Hash32)
branchChildLookup
putSyncCausal :: SyncCausalFormat' Hash32 Hash32 -> m ()
putSyncCausal Causal.SyncCausalFormat {Hash32
valueHash :: Hash32
$sel:valueHash:SyncCausalFormat :: forall causalHash valueHash.
SyncCausalFormat' causalHash valueHash -> valueHash
valueHash, Vector Hash32
parents :: Vector Hash32
$sel:parents:SyncCausalFormat :: forall causalHash valueHash.
SyncCausalFormat' causalHash valueHash -> Vector causalHash
parents} = do
Hash32 -> m ()
putHash32 Hash32
valueHash
(Hash32 -> m ()) -> Vector Hash32 -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Hash32 -> m ()
putHash32 Vector Hash32
parents
putSyncFullPatch :: PatchLocalIds' Text Hash32 Hash32 -> ByteString -> m ()
putSyncFullPatch PatchLocalIds' Text Hash32 Hash32
lids ByteString
bytes = do
PatchLocalIds' Text Hash32 Hash32 -> m ()
putPatchLocalIds PatchLocalIds' Text Hash32 Hash32
lids
ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putFramedByteString ByteString
bytes
putSyncDiffPatch :: Hash32 -> PatchLocalIds' Text Hash32 Hash32 -> ByteString -> m ()
putSyncDiffPatch Hash32
parent PatchLocalIds' Text Hash32 Hash32
lids ByteString
bytes = do
Hash32 -> m ()
putHash32 Hash32
parent
PatchLocalIds' Text Hash32 Hash32 -> m ()
putPatchLocalIds PatchLocalIds' Text Hash32 Hash32
lids
ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putFramedByteString ByteString
bytes
putSyncFullNamespace :: BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> ByteString -> m ()
putSyncFullNamespace BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
lids ByteString
bytes = do
BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32) -> m ()
putNamespaceLocalIds BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
lids
ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putFramedByteString ByteString
bytes
putSyncDiffNamespace :: Hash32
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> ByteString
-> m ()
putSyncDiffNamespace Hash32
parent BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
lids ByteString
bytes = do
Hash32 -> m ()
putHash32 Hash32
parent
BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32) -> m ()
putNamespaceLocalIds BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
lids
ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putFramedByteString ByteString
bytes
putSyncTerm :: SyncLocallyIndexedComponent' Text Hash32 -> m ()
putSyncTerm (TermFormat.SyncLocallyIndexedComponent Vector (LocalIds' Text Hash32, ByteString)
vec) =
(((LocalIds' Text Hash32, ByteString) -> m ())
-> Vector (LocalIds' Text Hash32, ByteString) -> m ())
-> Vector (LocalIds' Text Hash32, ByteString)
-> ((LocalIds' Text Hash32, ByteString) -> m ())
-> m ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((LocalIds' Text Hash32, ByteString) -> m ())
-> Vector (LocalIds' Text Hash32, ByteString) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Vector (LocalIds' Text Hash32, ByteString)
vec \(LocalIds' Text Hash32
localIds, ByteString
bytes) -> do
(Text -> m ()) -> (Hash32 -> m ()) -> LocalIds' Text Hash32 -> m ()
forall (m :: * -> *) t d.
MonadPut m =>
(t -> m ()) -> (d -> m ()) -> LocalIds' t d -> m ()
putLocalIdsWith Text -> m ()
forall (m :: * -> *). MonadPut m => Text -> m ()
putText Hash32 -> m ()
putHash32 LocalIds' Text Hash32
localIds
ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putFramedByteString ByteString
bytes
putSyncDecl :: SyncLocallyIndexedComponent' Text Hash32 -> m ()
putSyncDecl (DeclFormat.SyncLocallyIndexedComponent Vector (LocalIds' Text Hash32, ByteString)
vec) =
(((LocalIds' Text Hash32, ByteString) -> m ())
-> Vector (LocalIds' Text Hash32, ByteString) -> m ())
-> Vector (LocalIds' Text Hash32, ByteString)
-> ((LocalIds' Text Hash32, ByteString) -> m ())
-> m ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((LocalIds' Text Hash32, ByteString) -> m ())
-> Vector (LocalIds' Text Hash32, ByteString) -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable Vector (LocalIds' Text Hash32, ByteString)
vec \(LocalIds' Text Hash32
localIds, ByteString
bytes) -> do
(Text -> m ()) -> (Hash32 -> m ()) -> LocalIds' Text Hash32 -> m ()
forall (m :: * -> *) t d.
MonadPut m =>
(t -> m ()) -> (d -> m ()) -> LocalIds' t d -> m ()
putLocalIdsWith Text -> m ()
forall (m :: * -> *). MonadPut m => Text -> m ()
putText Hash32 -> m ()
putHash32 LocalIds' Text Hash32
localIds
ByteString -> m ()
forall (m :: * -> *). MonadPut m => ByteString -> m ()
putFramedByteString ByteString
bytes
getHash32 :: (MonadGet m) => m Hash32
getHash32 :: forall (m :: * -> *). MonadGet m => m Hash32
getHash32 = Base32Hex -> Hash32
Hash32.UnsafeFromBase32Hex (Base32Hex -> Hash32) -> (Text -> Base32Hex) -> Text -> Hash32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Base32Hex
Base32Hex.UnsafeFromText (Text -> Hash32) -> m Text -> m Hash32
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Text
forall (m :: * -> *). MonadGet m => m Text
getText
getTempTermFormat :: (MonadGet m) => m TempEntity.TempTermFormat
getTempTermFormat :: forall (m :: * -> *). MonadGet m => m (SyncTermFormat' Text Hash32)
getTempTermFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (SyncTermFormat' Text Hash32))
-> m (SyncTermFormat' Text Hash32)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 ->
SyncLocallyIndexedComponent' Text Hash32
-> SyncTermFormat' Text Hash32
forall t d. SyncLocallyIndexedComponent' t d -> SyncTermFormat' t d
TermFormat.SyncTerm (SyncLocallyIndexedComponent' Text Hash32
-> SyncTermFormat' Text Hash32)
-> (Vector (LocalIds' Text Hash32, ByteString)
-> SyncLocallyIndexedComponent' Text Hash32)
-> Vector (LocalIds' Text Hash32, ByteString)
-> SyncTermFormat' Text Hash32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector (LocalIds' Text Hash32, ByteString)
-> SyncLocallyIndexedComponent' Text Hash32
forall t d.
Vector (LocalIds' t d, ByteString)
-> SyncLocallyIndexedComponent' t d
TermFormat.SyncLocallyIndexedComponent
(Vector (LocalIds' Text Hash32, ByteString)
-> SyncTermFormat' Text Hash32)
-> m (Vector (LocalIds' Text Hash32, ByteString))
-> m (SyncTermFormat' Text Hash32)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (LocalIds' Text Hash32, ByteString)
-> m (Vector (LocalIds' Text Hash32, ByteString))
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector
( m (LocalIds' Text Hash32)
-> m ByteString -> m (LocalIds' Text Hash32, ByteString)
forall (m :: * -> *) a b. MonadGet m => m a -> m b -> m (a, b)
getPair
(m Text -> m Hash32 -> m (LocalIds' Text Hash32)
forall (m :: * -> *) t d.
MonadGet m =>
m t -> m d -> m (LocalIds' t d)
getLocalIdsWith m Text
forall (m :: * -> *). MonadGet m => m Text
getText m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32)
m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getFramedByteString
)
Word8
tag -> [Char] -> Word8 -> m (SyncTermFormat' Text Hash32)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTempTermFormat" Word8
tag
getTempDeclFormat :: (MonadGet m) => m TempEntity.TempDeclFormat
getTempDeclFormat :: forall (m :: * -> *). MonadGet m => m (SyncDeclFormat' Text Hash32)
getTempDeclFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (SyncDeclFormat' Text Hash32))
-> m (SyncDeclFormat' Text Hash32)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 ->
SyncLocallyIndexedComponent' Text Hash32
-> SyncDeclFormat' Text Hash32
forall t d. SyncLocallyIndexedComponent' t d -> SyncDeclFormat' t d
DeclFormat.SyncDecl (SyncLocallyIndexedComponent' Text Hash32
-> SyncDeclFormat' Text Hash32)
-> (Vector (LocalIds' Text Hash32, ByteString)
-> SyncLocallyIndexedComponent' Text Hash32)
-> Vector (LocalIds' Text Hash32, ByteString)
-> SyncDeclFormat' Text Hash32
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Vector (LocalIds' Text Hash32, ByteString)
-> SyncLocallyIndexedComponent' Text Hash32
forall t d.
Vector (LocalIds' t d, ByteString)
-> SyncLocallyIndexedComponent' t d
DeclFormat.SyncLocallyIndexedComponent
(Vector (LocalIds' Text Hash32, ByteString)
-> SyncDeclFormat' Text Hash32)
-> m (Vector (LocalIds' Text Hash32, ByteString))
-> m (SyncDeclFormat' Text Hash32)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (LocalIds' Text Hash32, ByteString)
-> m (Vector (LocalIds' Text Hash32, ByteString))
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector
( m (LocalIds' Text Hash32)
-> m ByteString -> m (LocalIds' Text Hash32, ByteString)
forall (m :: * -> *) a b. MonadGet m => m a -> m b -> m (a, b)
getPair
(m Text -> m Hash32 -> m (LocalIds' Text Hash32)
forall (m :: * -> *) t d.
MonadGet m =>
m t -> m d -> m (LocalIds' t d)
getLocalIdsWith m Text
forall (m :: * -> *). MonadGet m => m Text
getText m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32)
m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getFramedByteString
)
Word8
tag -> [Char] -> Word8 -> m (SyncDeclFormat' Text Hash32)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTempDeclFormat" Word8
tag
getTempPatchFormat :: (MonadGet m) => m TempEntity.TempPatchFormat
getTempPatchFormat :: forall (m :: * -> *).
MonadGet m =>
m (SyncPatchFormat' Hash32 Text Hash32 Hash32)
getTempPatchFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (SyncPatchFormat' Hash32 Text Hash32 Hash32))
-> m (SyncPatchFormat' Hash32 Text Hash32 Hash32)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> PatchLocalIds' Text Hash32 Hash32
-> ByteString -> SyncPatchFormat' Hash32 Text Hash32 Hash32
forall parent text hash defn.
PatchLocalIds' text hash defn
-> ByteString -> SyncPatchFormat' parent text hash defn
PatchFormat.SyncFull (PatchLocalIds' Text Hash32 Hash32
-> ByteString -> SyncPatchFormat' Hash32 Text Hash32 Hash32)
-> m (PatchLocalIds' Text Hash32 Hash32)
-> m (ByteString -> SyncPatchFormat' Hash32 Text Hash32 Hash32)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (PatchLocalIds' Text Hash32 Hash32)
getPatchLocalIds m (ByteString -> SyncPatchFormat' Hash32 Text Hash32 Hash32)
-> m ByteString -> m (SyncPatchFormat' Hash32 Text Hash32 Hash32)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getFramedByteString
Word8
1 -> Hash32
-> PatchLocalIds' Text Hash32 Hash32
-> ByteString
-> SyncPatchFormat' Hash32 Text Hash32 Hash32
forall parent text hash defn.
parent
-> PatchLocalIds' text hash defn
-> ByteString
-> SyncPatchFormat' parent text hash defn
PatchFormat.SyncDiff (Hash32
-> PatchLocalIds' Text Hash32 Hash32
-> ByteString
-> SyncPatchFormat' Hash32 Text Hash32 Hash32)
-> m Hash32
-> m (PatchLocalIds' Text Hash32 Hash32
-> ByteString -> SyncPatchFormat' Hash32 Text Hash32 Hash32)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32 m (PatchLocalIds' Text Hash32 Hash32
-> ByteString -> SyncPatchFormat' Hash32 Text Hash32 Hash32)
-> m (PatchLocalIds' Text Hash32 Hash32)
-> m (ByteString -> SyncPatchFormat' Hash32 Text Hash32 Hash32)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (PatchLocalIds' Text Hash32 Hash32)
getPatchLocalIds m (ByteString -> SyncPatchFormat' Hash32 Text Hash32 Hash32)
-> m ByteString -> m (SyncPatchFormat' Hash32 Text Hash32 Hash32)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getFramedByteString
Word8
tag -> [Char] -> Word8 -> m (SyncPatchFormat' Hash32 Text Hash32 Hash32)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTempPatchFormat" Word8
tag
where
getPatchLocalIds :: m (PatchLocalIds' Text Hash32 Hash32)
getPatchLocalIds =
Vector Text
-> Vector Hash32
-> Vector Hash32
-> PatchLocalIds' Text Hash32 Hash32
forall t h d.
Vector t -> Vector h -> Vector d -> PatchLocalIds' t h d
PatchFormat.LocalIds
(Vector Text
-> Vector Hash32
-> Vector Hash32
-> PatchLocalIds' Text Hash32 Hash32)
-> m (Vector Text)
-> m (Vector Hash32
-> Vector Hash32 -> PatchLocalIds' Text Hash32 Hash32)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Text -> m (Vector Text)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m Text
forall (m :: * -> *). MonadGet m => m Text
getText
m (Vector Hash32
-> Vector Hash32 -> PatchLocalIds' Text Hash32 Hash32)
-> m (Vector Hash32)
-> m (Vector Hash32 -> PatchLocalIds' Text Hash32 Hash32)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Hash32 -> m (Vector Hash32)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32
m (Vector Hash32 -> PatchLocalIds' Text Hash32 Hash32)
-> m (Vector Hash32) -> m (PatchLocalIds' Text Hash32 Hash32)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Hash32 -> m (Vector Hash32)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32
getTempNamespaceFormat :: (MonadGet m) => m TempEntity.TempNamespaceFormat
getTempNamespaceFormat :: forall (m :: * -> *).
MonadGet m =>
m (SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
getTempNamespaceFormat =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8
-> m (SyncBranchFormat'
Hash32 Text Hash32 Hash32 (Hash32, Hash32)))
-> m (SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32)
forall parent text defn patch child.
BranchLocalIds' text defn patch child
-> LocalBranchBytes
-> SyncBranchFormat' parent text defn patch child
BranchFormat.SyncFull (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
-> m (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
-> m (LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
getBranchLocalIds m (LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
-> m LocalBranchBytes
-> m (SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ByteString -> LocalBranchBytes
BranchFormat.LocalBranchBytes (ByteString -> LocalBranchBytes)
-> m ByteString -> m LocalBranchBytes
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getFramedByteString)
Word8
1 -> Hash32
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32)
forall parent text defn patch child.
parent
-> BranchLocalIds' text defn patch child
-> LocalBranchBytes
-> SyncBranchFormat' parent text defn patch child
BranchFormat.SyncDiff (Hash32
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
-> m Hash32
-> m (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32 m (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
-> LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
-> m (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
-> m (LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
getBranchLocalIds m (LocalBranchBytes
-> SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
-> m LocalBranchBytes
-> m (SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (ByteString -> LocalBranchBytes
BranchFormat.LocalBranchBytes (ByteString -> LocalBranchBytes)
-> m ByteString -> m LocalBranchBytes
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m ByteString
forall (m :: * -> *). MonadGet m => m ByteString
getFramedByteString)
Word8
tag -> [Char]
-> Word8
-> m (SyncBranchFormat' Hash32 Text Hash32 Hash32 (Hash32, Hash32))
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getTempNamespaceFormat" Word8
tag
where
getBranchLocalIds :: m (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
getBranchLocalIds =
Vector Text
-> Vector Hash32
-> Vector Hash32
-> Vector (Hash32, Hash32)
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32)
forall t d p c.
Vector t
-> Vector d -> Vector p -> Vector c -> BranchLocalIds' t d p c
BranchFormat.LocalIds
(Vector Text
-> Vector Hash32
-> Vector Hash32
-> Vector (Hash32, Hash32)
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
-> m (Vector Text)
-> m (Vector Hash32
-> Vector Hash32
-> Vector (Hash32, Hash32)
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Text -> m (Vector Text)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m Text
forall (m :: * -> *). MonadGet m => m Text
getText
m (Vector Hash32
-> Vector Hash32
-> Vector (Hash32, Hash32)
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
-> m (Vector Hash32)
-> m (Vector Hash32
-> Vector (Hash32, Hash32)
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Hash32 -> m (Vector Hash32)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32
m (Vector Hash32
-> Vector (Hash32, Hash32)
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
-> m (Vector Hash32)
-> m (Vector (Hash32, Hash32)
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Hash32 -> m (Vector Hash32)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32
m (Vector (Hash32, Hash32)
-> BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
-> m (Vector (Hash32, Hash32))
-> m (BranchLocalIds' Text Hash32 Hash32 (Hash32, Hash32))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m (Hash32, Hash32) -> m (Vector (Hash32, Hash32))
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector (m Hash32 -> m Hash32 -> m (Hash32, Hash32)
forall (m :: * -> *) a b. MonadGet m => m a -> m b -> m (a, b)
getPair m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32 m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32)
getTempCausalFormat :: (MonadGet m) => m TempEntity.TempCausalFormat
getTempCausalFormat :: forall (m :: * -> *).
MonadGet m =>
m (SyncCausalFormat' Hash32 Hash32)
getTempCausalFormat =
Hash32 -> Vector Hash32 -> SyncCausalFormat' Hash32 Hash32
forall causalHash valueHash.
valueHash
-> Vector causalHash -> SyncCausalFormat' causalHash valueHash
Causal.SyncCausalFormat
(Hash32 -> Vector Hash32 -> SyncCausalFormat' Hash32 Hash32)
-> m Hash32 -> m (Vector Hash32 -> SyncCausalFormat' Hash32 Hash32)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32
m (Vector Hash32 -> SyncCausalFormat' Hash32 Hash32)
-> m (Vector Hash32) -> m (SyncCausalFormat' Hash32 Hash32)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Hash32 -> m (Vector Hash32)
forall (m :: * -> *) a. MonadGet m => m a -> m (Vector a)
getVector m Hash32
forall (m :: * -> *). MonadGet m => m Hash32
getHash32
getSymbol :: (MonadGet m) => m Symbol
getSymbol :: forall (m :: * -> *). MonadGet m => m Symbol
getSymbol = ConstructorId -> Text -> Symbol
Symbol (ConstructorId -> Text -> Symbol)
-> m ConstructorId -> m (Text -> Symbol)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m (Text -> Symbol) -> m Text -> m Symbol
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m Text
forall (m :: * -> *). MonadGet m => m Text
getText
skipSymbol :: (MonadGet m) => m ()
skipSymbol :: forall (m :: * -> *). MonadGet m => m ()
skipSymbol = do
ConstructorId
_ :: Word64 <- m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
m ()
forall (m :: * -> *). MonadGet m => m ()
skipText
putSymbol :: (MonadPut m) => Symbol -> m ()
putSymbol :: forall (m :: * -> *). MonadPut m => Symbol -> m ()
putSymbol (Symbol ConstructorId
n Text
t) = ConstructorId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ConstructorId
n m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Text -> m ()
forall (m :: * -> *). MonadPut m => Text -> m ()
putText Text
t
putReferent ::
( MonadPut m,
Integral t1,
Integral h1,
Bits t1,
Bits h1,
Integral t2,
Integral h2,
Bits t2,
Bits h2
) =>
Referent' (Reference' t1 h1) (Reference' t2 h2) ->
m ()
putReferent :: forall (m :: * -> *) t1 h1 t2 h2.
(MonadPut m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
Referent' (Reference' t1 h1) (Reference' t2 h2) -> m ()
putReferent = (Reference' t1 h1 -> m ())
-> (Reference' t2 h2 -> m ())
-> Referent' (Reference' t1 h1) (Reference' t2 h2)
-> m ()
forall (m :: * -> *) r1 r2.
MonadPut m =>
(r1 -> m ()) -> (r2 -> m ()) -> Referent' r1 r2 -> m ()
putReferent' Reference' t1 h1 -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference Reference' t2 h2 -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference
putReferent' :: (MonadPut m) => (r1 -> m ()) -> (r2 -> m ()) -> Referent' r1 r2 -> m ()
putReferent' :: forall (m :: * -> *) r1 r2.
MonadPut m =>
(r1 -> m ()) -> (r2 -> m ()) -> Referent' r1 r2 -> m ()
putReferent' r1 -> m ()
putRefRef r2 -> m ()
putConRef = \case
Referent.Ref r1
r -> do
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
r1 -> m ()
putRefRef r1
r
Referent.Con r2
r ConstructorId
i -> do
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1
r2 -> m ()
putConRef r2
r
ConstructorId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ConstructorId
i
putReference ::
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r ->
m ()
putReference :: forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference = \case
ReferenceBuiltin t
t ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> t -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt t
t
ReferenceDerived (Reference.Id r
r ConstructorId
index) ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> r -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt r
r m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ConstructorId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ConstructorId
index
getReferent' :: (MonadGet m) => m r1 -> m r2 -> m (Referent' r1 r2)
getReferent' :: forall (m :: * -> *) r1 r2.
MonadGet m =>
m r1 -> m r2 -> m (Referent' r1 r2)
getReferent' m r1
getRefRef m r2
getConRef =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m (Referent' r1 r2)) -> m (Referent' r1 r2)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> r1 -> Referent' r1 r2
forall termRef typeRef. termRef -> Referent' termRef typeRef
Referent.Ref (r1 -> Referent' r1 r2) -> m r1 -> m (Referent' r1 r2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m r1
getRefRef
Word8
1 -> r2 -> ConstructorId -> Referent' r1 r2
forall termRef typeRef.
typeRef -> ConstructorId -> Referent' termRef typeRef
Referent.Con (r2 -> ConstructorId -> Referent' r1 r2)
-> m r2 -> m (ConstructorId -> Referent' r1 r2)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m r2
getConRef m (ConstructorId -> Referent' r1 r2)
-> m ConstructorId -> m (Referent' r1 r2)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
x -> [Char] -> Word8 -> m (Referent' r1 r2)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getReferent" Word8
x
getReferent ::
( MonadGet m,
Integral t1,
Integral h1,
Bits t1,
Bits h1,
Integral t2,
Integral h2,
Bits t2,
Bits h2
) =>
m (Referent' (Reference' t1 h1) (Reference' t2 h2))
getReferent :: forall (m :: * -> *) t1 h1 t2 h2.
(MonadGet m, Integral t1, Integral h1, Bits t1, Bits h1,
Integral t2, Integral h2, Bits t2, Bits h2) =>
m (Referent' (Reference' t1 h1) (Reference' t2 h2))
getReferent = m (Reference' t1 h1)
-> m (Reference' t2 h2)
-> m (Referent' (Reference' t1 h1) (Reference' t2 h2))
forall (m :: * -> *) r1 r2.
MonadGet m =>
m r1 -> m r2 -> m (Referent' r1 r2)
getReferent' m (Reference' t1 h1)
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference m (Reference' t2 h2)
forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference
getReference ::
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference :: forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t r)
getReference =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m (Reference' t r)) -> m (Reference' t r)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> t -> Reference' t r
forall t h. t -> Reference' t h
ReferenceBuiltin (t -> Reference' t r) -> m t -> m (Reference' t r)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m t
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
1 -> Id' r -> Reference' t r
forall t h. Id' h -> Reference' t h
ReferenceDerived (Id' r -> Reference' t r) -> m (Id' r) -> m (Reference' t r)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (r -> ConstructorId -> Id' r
forall h. h -> ConstructorId -> Id' h
Reference.Id (r -> ConstructorId -> Id' r) -> m r -> m (ConstructorId -> Id' r)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m r
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m (ConstructorId -> Id' r) -> m ConstructorId -> m (Id' r)
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt)
Word8
x -> [Char] -> Word8 -> m (Reference' t r)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getRecursiveReference" Word8
x
putRecursiveReference ::
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t (Maybe r) ->
m ()
putRecursiveReference :: forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t (Maybe r) -> m ()
putRecursiveReference = \case
ReferenceBuiltin t
t ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> t -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt t
t
ReferenceDerived (Reference.Id Maybe r
r ConstructorId
index) ->
Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (r -> m ()) -> Maybe r -> m ()
forall (m :: * -> *) a.
MonadPut m =>
(a -> m ()) -> Maybe a -> m ()
putMaybe r -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt Maybe r
r m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> ConstructorId -> m ()
forall (m :: * -> *) a.
(MonadPut m, Integral a, Bits a) =>
a -> m ()
putVarInt ConstructorId
index
getRecursiveReference ::
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t (Maybe r))
getRecursiveReference :: forall (m :: * -> *) t r.
(MonadGet m, Integral t, Bits t, Integral r, Bits r) =>
m (Reference' t (Maybe r))
getRecursiveReference =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8
-> (Word8 -> m (Reference' t (Maybe r)))
-> m (Reference' t (Maybe r))
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> t -> Reference' t (Maybe r)
forall t h. t -> Reference' t h
ReferenceBuiltin (t -> Reference' t (Maybe r)) -> m t -> m (Reference' t (Maybe r))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m t
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt
Word8
1 -> Id' (Maybe r) -> Reference' t (Maybe r)
forall t h. Id' h -> Reference' t h
ReferenceDerived (Id' (Maybe r) -> Reference' t (Maybe r))
-> m (Id' (Maybe r)) -> m (Reference' t (Maybe r))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Maybe r -> ConstructorId -> Id' (Maybe r)
forall h. h -> ConstructorId -> Id' h
Reference.Id (Maybe r -> ConstructorId -> Id' (Maybe r))
-> m (Maybe r) -> m (ConstructorId -> Id' (Maybe r))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m r -> m (Maybe r)
forall (m :: * -> *) a. MonadGet m => m a -> m (Maybe a)
getMaybe m r
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt m (ConstructorId -> Id' (Maybe r))
-> m ConstructorId -> m (Id' (Maybe r))
forall a b. m (a -> b) -> m a -> m b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m ConstructorId
forall (m :: * -> *) b. (MonadGet m, Num b, Bits b) => m b
getVarInt)
Word8
x -> [Char] -> Word8 -> m (Reference' t (Maybe r))
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"getRecursiveReference" Word8
x
putInt :: (MonadPut m) => Int64 -> m ()
putInt :: forall (m :: * -> *). MonadPut m => Int64 -> m ()
putInt = Int64 -> m ()
forall a (m :: * -> *). (SerialEndian a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => Int64 -> m ()
serializeBE
getInt :: (MonadGet m) => m Int64
getInt :: forall (m :: * -> *). MonadGet m => m Int64
getInt = m Int64
forall a (m :: * -> *). (SerialEndian a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m Int64
deserializeBE
putNat :: (MonadPut m) => Word64 -> m ()
putNat :: forall (m :: * -> *). MonadPut m => ConstructorId -> m ()
putNat = ConstructorId -> m ()
forall a (m :: * -> *). (SerialEndian a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => ConstructorId -> m ()
serializeBE
getNat :: (MonadGet m) => m Word64
getNat :: forall (m :: * -> *). MonadGet m => m ConstructorId
getNat = m ConstructorId
forall a (m :: * -> *). (SerialEndian a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m ConstructorId
deserializeBE
putFloat :: (MonadPut m) => Double -> m ()
putFloat :: forall (m :: * -> *). MonadPut m => Double -> m ()
putFloat = Double -> m ()
forall a (m :: * -> *). (SerialEndian a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => Double -> m ()
serializeBE
getFloat :: (MonadGet m) => m Double
getFloat :: forall (m :: * -> *). MonadGet m => m Double
getFloat = m Double
forall a (m :: * -> *). (SerialEndian a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m Double
deserializeBE
putBoolean :: (MonadPut m) => Bool -> m ()
putBoolean :: forall (m :: * -> *). MonadPut m => Bool -> m ()
putBoolean Bool
False = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
putBoolean Bool
True = Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1
getBoolean :: (MonadGet m) => m Bool
getBoolean :: forall (m :: * -> *). MonadGet m => m Bool
getBoolean =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m Bool) -> m Bool
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Word8
0 -> Bool -> m Bool
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
False
Word8
1 -> Bool -> m Bool
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
True
Word8
x -> [Char] -> Word8 -> m Bool
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"Boolean" Word8
x
putTType :: (MonadPut m) => TermFormat.Type -> m ()
putTType :: forall (m :: * -> *). MonadPut m => Type -> m ()
putTType = (TypeRef -> m ()) -> (Symbol -> m ()) -> Type -> m ()
forall (m :: * -> *) r v.
(MonadPut m, Ord v) =>
(r -> m ()) -> (v -> m ()) -> TypeR r v -> m ()
putType TypeRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t r -> m ()
putReference Symbol -> m ()
forall (m :: * -> *). MonadPut m => Symbol -> m ()
putSymbol
putDType :: (MonadPut m) => DeclFormat.Type Symbol -> m ()
putDType :: forall (m :: * -> *). MonadPut m => TypeR TermRef Symbol -> m ()
putDType = (TermRef -> m ())
-> (Symbol -> m ()) -> TypeR TermRef Symbol -> m ()
forall (m :: * -> *) r v.
(MonadPut m, Ord v) =>
(r -> m ()) -> (v -> m ()) -> TypeR r v -> m ()
putType TermRef -> m ()
forall (m :: * -> *) t r.
(MonadPut m, Integral t, Bits t, Integral r, Bits r) =>
Reference' t (Maybe r) -> m ()
putRecursiveReference Symbol -> m ()
forall (m :: * -> *). MonadPut m => Symbol -> m ()
putSymbol
putType ::
forall m r v.
(MonadPut m, Ord v) =>
(r -> m ()) ->
(v -> m ()) ->
Type.TypeR r v ->
m ()
putType :: forall (m :: * -> *) r v.
(MonadPut m, Ord v) =>
(r -> m ()) -> (v -> m ()) -> TypeR r v -> m ()
putType r -> m ()
putReference v -> m ()
putVar = (v -> m ())
-> (() -> m ())
-> (forall x. (x -> m ()) -> F' r x -> m ())
-> Term (F' r) v ()
-> m ()
forall (m :: * -> *) (f :: * -> *) v a.
(MonadPut m, Foldable f, Functor f, Ord v) =>
(v -> m ())
-> (a -> m ())
-> (forall x. (x -> m ()) -> f x -> m ())
-> Term f v a
-> m ()
putABT v -> m ()
putVar () -> m ()
forall (m :: * -> *). Applicative m => () -> m ()
putUnit (x -> m ()) -> F' r x -> m ()
forall x. (x -> m ()) -> F' r x -> m ()
go
where
go :: (x -> m ()) -> Type.F' r x -> m ()
go :: forall x. (x -> m ()) -> F' r x -> m ()
go x -> m ()
putChild F' r x
t = case F' r x
t of
Type.Ref r
r -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> r -> m ()
putReference r
r
Type.Arrow x
i x
o -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
i m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
o
Type.Ann x
t Kind
k -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
2 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
t m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> MonadPut m => Kind -> m ()
Kind -> m ()
putKind Kind
k
Type.App x
f x
x -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
3 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
f m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
x
Type.Effect x
e x
t -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
4 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
e m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
t
Type.Effects [x]
es -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
5 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (x -> m ()) -> [x] -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Foldable f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
putFoldable x -> m ()
putChild [x]
es
Type.Forall x
body -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
6 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
body
Type.IntroOuter x
body -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
7 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> x -> m ()
putChild x
body
putKind :: (MonadPut m) => Kind -> m ()
putKind :: MonadPut m => Kind -> m ()
putKind Kind
k = case Kind
k of
Kind
Kind.Star -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
Kind.Arrow Kind
i Kind
o -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> MonadPut m => Kind -> m ()
Kind -> m ()
putKind Kind
i m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> MonadPut m => Kind -> m ()
Kind -> m ()
putKind Kind
o
putChar :: (MonadPut m) => Char -> m ()
putChar :: forall (m :: * -> *). MonadPut m => Char -> m ()
putChar = VarInt Int -> m ()
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => VarInt Int -> m ()
serialize (VarInt Int -> m ()) -> (Char -> VarInt Int) -> Char -> m ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> VarInt Int
forall n. n -> VarInt n
VarInt (Int -> VarInt Int) -> (Char -> Int) -> Char -> VarInt Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
forall a. Enum a => a -> Int
fromEnum
getChar :: (MonadGet m) => m Char
getChar :: forall (m :: * -> *). MonadGet m => m Char
getChar = Int -> Char
forall a. Enum a => Int -> a
toEnum (Int -> Char) -> (VarInt Int -> Int) -> VarInt Int -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. VarInt Int -> Int
forall n. VarInt n -> n
unVarInt (VarInt Int -> Char) -> m (VarInt Int) -> m Char
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m (VarInt Int)
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m (VarInt Int)
deserialize
putMaybe :: (MonadPut m) => (a -> m ()) -> Maybe a -> m ()
putMaybe :: forall (m :: * -> *) a.
MonadPut m =>
(a -> m ()) -> Maybe a -> m ()
putMaybe a -> m ()
putA = \case
Maybe a
Nothing -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
0
Just a
a -> Word8 -> m ()
forall (m :: * -> *). MonadPut m => Word8 -> m ()
putWord8 Word8
1 m () -> m () -> m ()
forall a b. m a -> m b -> m b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> a -> m ()
putA a
a
getMaybe :: (MonadGet m) => m a -> m (Maybe a)
getMaybe :: forall (m :: * -> *) a. MonadGet m => m a -> m (Maybe a)
getMaybe m a
getA =
m Word8
forall (m :: * -> *). MonadGet m => m Word8
getWord8 m Word8 -> (Word8 -> m (Maybe a)) -> m (Maybe a)
forall a b. m a -> (a -> m b) -> m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Word8
tag -> case Word8
tag of
Word8
0 -> Maybe a -> m (Maybe a)
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe a
forall a. Maybe a
Nothing
Word8
1 -> a -> Maybe a
forall a. a -> Maybe a
Just (a -> Maybe a) -> m a -> m (Maybe a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
getA
Word8
_ -> [Char] -> Word8 -> m (Maybe a)
forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
"Maybe" Word8
tag
unknownTag :: (MonadGet m, Show a) => String -> a -> m x
unknownTag :: forall (m :: * -> *) a x.
(MonadGet m, Show a) =>
[Char] -> a -> m x
unknownTag [Char]
msg a
tag =
[Char] -> m x
forall a. [Char] -> m a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
fail ([Char] -> m x) -> [Char] -> m x
forall a b. (a -> b) -> a -> b
$ [Char]
"unknown tag " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ a -> [Char]
forall a. Show a => a -> [Char]
show a
tag [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
" while deserializing: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
msg