unison-runtime-0.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Unison.Runtime.ANF.Serialize

Synopsis

Documentation

data TmTag Source #

Instances

Instances details
Tag TmTag Source # 
Instance details

Defined in Unison.Runtime.ANF.Serialize

data FnTag Source #

Instances

Instances details
Tag FnTag Source # 
Instance details

Defined in Unison.Runtime.ANF.Serialize

data MtTag Source #

Constructors

MIntT 
MTextT 
MReqT 
MEmptyT 
MDataT 
MSumT 
MNumT 

Instances

Instances details
Tag MtTag Source # 
Instance details

Defined in Unison.Runtime.ANF.Serialize

data LtTag Source #

Constructors

IT 
NT 
FT 
TT 
CT 
LMT 
LYT 

Instances

Instances details
Tag LtTag Source # 
Instance details

Defined in Unison.Runtime.ANF.Serialize

data BLTag Source #

Instances

Instances details
Tag BLTag Source # 
Instance details

Defined in Unison.Runtime.ANF.Serialize

data VaTag Source #

Constructors

PartialT 
DataT 
ContT 
BLitT 

Instances

Instances details
Tag VaTag Source # 
Instance details

Defined in Unison.Runtime.ANF.Serialize

data CoTag Source #

Constructors

KET 
MarkT 
PushT 

Instances

Instances details
Tag CoTag Source # 
Instance details

Defined in Unison.Runtime.ANF.Serialize

index :: Eq v => [v] -> v -> Maybe Word64 Source #

deindex :: HasCallStack => [v] -> Word64 -> v Source #

pushCtx :: [v] -> [v] -> [v] Source #

putIndex :: MonadPut m => Word64 -> m () Source #

putVar :: MonadPut m => Eq v => [v] -> v -> m () Source #

getVar :: MonadGet m => [v] -> m v Source #

putArgs :: MonadPut m => Eq v => [v] -> [v] -> m () Source #

getArgs :: MonadGet m => [v] -> m [v] Source #

putCCs :: MonadPut m => [Mem] -> m () Source #

getCCs :: MonadGet m => m [Mem] Source #

getGroup :: MonadGet m => Var v => m (SuperGroup v) Source #

putComb :: MonadPut m => Var v => Map Reference Word64 -> EnumMap FOp Text -> [v] -> SuperNormal v -> m () Source #

getFresh :: Var v => Word64 -> v Source #

getComb :: MonadGet m => Var v => [v] -> Word64 -> m (SuperNormal v) Source #

putNormal :: MonadPut m => Var v => Map Reference Word64 -> EnumMap FOp Text -> [v] -> ANormal v -> m () Source #

getNormal :: MonadGet m => Var v => [v] -> Word64 -> m (ANormal v) Source #

putFunc :: MonadPut m => Var v => Map Reference Word64 -> EnumMap FOp Text -> [v] -> Func v -> m () Source #

getFunc :: MonadGet m => Var v => [v] -> m (Func v) Source #

putPOp :: MonadPut m => POp -> m () Source #

putLit :: MonadPut m => Lit -> m () Source #

putBLit :: MonadPut m => BLit -> m () Source #

putRefs :: MonadPut m => [Reference] -> m () Source #

getBranches :: MonadGet m => Var v => [v] -> Word64 -> m (Branched (ANormal v)) Source #

putCase :: MonadPut m => Var v => Map Reference Word64 -> EnumMap FOp Text -> [v] -> ([Mem], ANormal v) -> m () Source #

getCase :: MonadGet m => Var v => [v] -> Word64 -> m ([Mem], ANormal v) Source #

putCTag :: MonadPut m => CTag -> m () Source #

putValue :: MonadPut m => Value -> m () Source #

putCont :: MonadPut m => Cont -> m () Source #

serializeGroupForRehash :: Var v => EnumMap FOp Text -> Reference -> SuperGroup v -> ByteString Source #

Serializes a SuperGroup for rehashing.

Expected as arguments are some code, and the Reference that refers to it. In particular, if the code refers to itself by reference, or if the code is part of a mututally-recursive set of definitions (which have a common hash), the reference used as part of that (mutual) recursion must be supplied.

Using that reference, we find all references in the code to that connected component. In the resulting byte string, those references are instead replaced by positions in a listing of the connected component. This means that the byte string is independent of the hash used for the self reference. Only the order matters (which is determined by the Reference). Then the bytes can be re-hashed to establish a new hash for the connected component. This operation should be idempotent as long as the indexing is preserved.

Supplying a Builtin reference is not supported. Such code shouldn't be subject to rehashing.