mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-06-28 15:21:33 +00:00
Implement wrapper compiler
This commit is contained in:
@ -13,9 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
type SomeNonArrowTypes = ScalarType | OptionType | ArrayType | StructType | TopType | BottomType;
|
||||
type SimpleTypes = ScalarType | OptionType | ArrayType | StructType | TopType | BottomType | NilType;
|
||||
|
||||
export type NonArrowType = SomeNonArrowTypes | ProductType<SomeNonArrowTypes>;
|
||||
export type NonArrowType = SimpleTypes | ProductType<SimpleTypes>;
|
||||
|
||||
export type TopType = {
|
||||
/**
|
||||
@ -108,35 +108,31 @@ export type StructType = {
|
||||
fields: { [key: string]: NonArrowType };
|
||||
};
|
||||
|
||||
export type LabeledProductType<T> =
|
||||
| {
|
||||
/**
|
||||
* Type descriptor. Used for pattern-matching
|
||||
*/
|
||||
tag: 'labeledProduct';
|
||||
export type LabeledProductType<T> = {
|
||||
/**
|
||||
* Type descriptor. Used for pattern-matching
|
||||
*/
|
||||
tag: 'labeledProduct';
|
||||
|
||||
/**
|
||||
* Labelled product fields
|
||||
*/
|
||||
fields: { [key: string]: T };
|
||||
}
|
||||
| NilType;
|
||||
/**
|
||||
* Labelled product fields
|
||||
*/
|
||||
fields: { [key: string]: T };
|
||||
};
|
||||
|
||||
export type UnlabeledProductType<T> =
|
||||
| {
|
||||
/**
|
||||
* Type descriptor. Used for pattern-matching
|
||||
*/
|
||||
tag: 'unlabeledProduct';
|
||||
export type UnlabeledProductType<T> = {
|
||||
/**
|
||||
* Type descriptor. Used for pattern-matching
|
||||
*/
|
||||
tag: 'unlabeledProduct';
|
||||
|
||||
/**
|
||||
* Items in unlabelled product
|
||||
*/
|
||||
items: Array<T>;
|
||||
}
|
||||
| NilType;
|
||||
/**
|
||||
* Items in unlabelled product
|
||||
*/
|
||||
items: Array<T>;
|
||||
};
|
||||
|
||||
export type ProductType<T> = UnlabeledProductType<T> | LabeledProductType<T>;
|
||||
export type ProductType<T> = UnlabeledProductType<T> | LabeledProductType<T> | NilType;
|
||||
|
||||
/**
|
||||
* ArrowType is a profunctor pointing its domain to codomain.
|
||||
@ -233,12 +229,12 @@ export interface ServiceDef {
|
||||
/**
|
||||
* Default service id. If the service has no default id the value should be undefined
|
||||
*/
|
||||
defaultServiceId?: string;
|
||||
defaultServiceId?: {};
|
||||
|
||||
/**
|
||||
* List of functions which the service consists of
|
||||
*/
|
||||
functions: LabeledProductType<ArrowWithoutCallbacks>;
|
||||
functions: LabeledProductType<ArrowWithoutCallbacks> | NilType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user