add serializable iface
This commit is contained in:
parent
3d08485a08
commit
97b4e83379
1 changed files with 10 additions and 21 deletions
|
|
@ -1,27 +1,16 @@
|
|||
import { fnType } from "../type_registry.js";
|
||||
import { fnType, getListType } from "../type_registry.js";
|
||||
import {Type, Function} from "../metacircular.js";
|
||||
import { Byte } from "../primitives/symbols.js";
|
||||
|
||||
import {Bool, Int} from "./symbols.js";
|
||||
export const Serializable = Symbol('Serializable');
|
||||
|
||||
export const addInt = x => y => x + y;
|
||||
export const mulInt = x => y => x * y;
|
||||
export const eqInt = x => y => x === y;
|
||||
const ListOfByte = getListType(Byte);
|
||||
|
||||
const Int_to_Int = fnType({in: Int, out: Int });
|
||||
const Int_to_Bool = fnType({in: Int, out: Bool});
|
||||
export const Int_to_Int_to_Int = fnType({in: Int, out: Int_to_Int});
|
||||
export const Int_to_Int_to_Bool = fnType({in: Int, out: Int_to_Bool});
|
||||
const serializeFnType = fnType({in: Serializable, out: ListOfByte});
|
||||
const deserializeFnType = fnType({in: ListOfByte, out: Serializable});
|
||||
|
||||
|
||||
export const ModuleInt = [
|
||||
{i: Int , t: Type },
|
||||
|
||||
{i: Int_to_Int_to_Int , t: Function },
|
||||
{i: Int_to_Int_to_Bool , t: Function },
|
||||
{i: Int_to_Int , t: Function },
|
||||
{i: Int_to_Bool , t: Function },
|
||||
|
||||
{i: addInt , t: Int_to_Int_to_Int },
|
||||
{i: mulInt , t: Int_to_Int_to_Int },
|
||||
{i: eqInt , t: Int_to_Int_to_Bool },
|
||||
export const ModuleSerializable = [
|
||||
{i: Serializable , t: Type},
|
||||
{i: serializeFnType , t: Function},
|
||||
{i: deserializeFnType, t: Function},
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue