@helios-lang/compiler
Version:
Helios is a Domain Specific Language that compiles to Plutus-Core (i.e. Cardano on-chain validator scripts). Helios is a non-Haskell alternative to Plutus. With this library you can compile Helios scripts and build Cardano transactions, all you need to bu
1,213 lines • 28.8 kB
TypeScript
/**
* @param {ExpandTupleCallback} callback
*/
export function registerExpandTupleType(callback: ExpandTupleCallback): void;
/**
* @param {MakeListCallback} callback
*/
export function registerMakeListType(callback: MakeListCallback): void;
/**
* @param {MakeMapCallback} callback
*/
export function registerMakeMapType(callback: MakeMapCallback): void;
/**
* @typedef {{
* name: string
* typeClass: TypeClass
* }} ParameterI
*/
/**
* @typedef {Map<ParameterI, Type>} InferenceMap
*/
/**
* @typedef {Named & Type & {
* asDataType: DataType
* fieldNames: string[]
* toSchema(parents?: Set<string>): TypeSchema
* ready: boolean
* }} DataType
*/
/**
* @typedef {DataType & {
* asEnumMemberType: EnumMemberType
* constrIndex: number
* parentType: DataType
* }} EnumMemberType
*/
/**
* EvalEntities assert themselves
* @typedef {{
* asDataType: (null | DataType)
* asEnumMemberType: (null | EnumMemberType)
* asFunc: (null | Func)
* asInstance: (null | Instance)
* asNamed: (null | Named)
* asNamespace: (null | Namespace)
* asParametric: (null | Parametric)
* asType: (null | Type)
* asTyped: (null | Typed)
* asTypeClass: (null | TypeClass)
* toString(): string
* }} EvalEntity
*/
/**
* @typedef {Typed & {
* asFunc: Func
* funcType: FuncType
* call(site: Site, args: Typed[], namedArgs?: {[name: string]: Typed}, viableCasts?: ViableCasts): Typed
* }} Func
*/
/**
* @typedef {Typed & {
* asInstance: Instance
* fieldNames: string[]
* instanceMembers: InstanceMembers
* }} Instance
*/
/**
* @typedef {EvalEntity & {
* asNamed: Named
* name: string
* path: string
* }} Named
*/
/**
* @typedef {EvalEntity & {
* asNamespace: Namespace
* namespaceMembers: NamespaceMembers
* }} Namespace
*/
/**
* @typedef {EvalEntity & {
* asParametric: Parametric
* typeClasses: TypeClass[]
* apply(types: Type[], site?: Site): EvalEntity
* inferCall(site: Site, args: Typed[], namedArgs?: {[name: string]: Typed}, paramTypes?: Type[]): Func
* infer(site: Site, map: InferenceMap): Parametric
* }} Parametric
*/
/**
* @typedef {EvalEntity & {
* asType: Type
* instanceMembers: InstanceMembers
* typeMembers: TypeMembers
* isBaseOf(type: Type): boolean
* infer(site: Site, map: InferenceMap, type: null | Type): Type
* toTyped(): Typed
* isParametric(): boolean
* }} Type
*/
/**
* @typedef {EvalEntity & {
* asTyped: Typed
* type: Type
* }} Typed
*/
/**
* @typedef {EvalEntity & {
* asTypeClass: TypeClass
* genInstanceMembers(impl: Type): TypeClassMembers
* genTypeMembers(impl: Type): TypeClassMembers
* isImplementedBy(type: Type): boolean
* toType(name: string, path: string, parameter?: null | ParameterI): Type
* }} TypeClass
*/
/**
* @typedef {{[name: string]: (Parametric | Type)}} InstanceMembers
*/
/**
* @typedef {{[name: string]: EvalEntity}} NamespaceMembers
*/
/**
* @typedef {{[name: string]: (Parametric | Type | Typed)}} TypeMembers
*/
/**
* @typedef {{[name: string]: Type}} TypeClassMembers
*/
/**
* @param {Parametric} parametric
* @param {Type[]} types
* @returns {DataType}
*/
export function applyTypes(parametric: Parametric, ...types: Type[]): DataType;
/**
* @param {DataType} enumType
* @returns {[string, EnumMemberType][]}
*/
export function collectEnumMembers(enumType: DataType): [string, EnumMemberType][];
/**
* @typedef {(type: Type) => DataType} MakeListCallback
*/
/**
* @type {MakeListCallback | undefined}
*/
export const makeListType: MakeListCallback | undefined;
/**
* @typedef {(keyType: Type, valueType: Type) => DataType} MakeMapCallback
*/
/**
* @type {MakeMapCallback | undefined}
*/
export const makeMapType: MakeMapCallback | undefined;
export class Common {
/**
* @param {Typed} i
* @param {Type} t
* @returns {boolean}
*/
static instanceOf(i: Typed, t: Type): boolean;
/**
* Compares two types. Throws an error if neither is a Type.
* @example
* Common.typesEq(IntType, IntType) == true
* @param {Type} a
* @param {Type} b
* @returns {boolean}
*/
static typesEq(a: Type, b: Type): boolean;
/**
* @param {Type} type
*/
static isEnum(type: Type): boolean;
/**
* @param {Type} type
*/
static countEnumMembers(type: Type): number;
/**
* @param {TypeClass} tc
* @returns {string[]}
*/
static typeClassMembers(tc: TypeClass): string[];
/**
* @param {Type} type
* @param {TypeClass} tc
* @returns {boolean}
*/
static typeImplements(type: Type, tc: TypeClass): boolean;
/**
* @returns {boolean}
*/
isParametric(): boolean;
/**
* @type {null | DataType}
*/
get asDataType(): DataType | null;
/**
* @type {null | EnumMemberType}
*/
get asEnumMemberType(): EnumMemberType | null;
/**
* @type {null | Func}
*/
get asFunc(): Func | null;
/**
* @type {null | Instance}
*/
get asInstance(): Instance | null;
/**
* @type {null | Named}
*/
get asNamed(): Named | null;
/**
* @type {null | Namespace}
*/
get asNamespace(): Namespace | null;
/**
* @type {null | Parametric}
*/
get asParametric(): Parametric | null;
/**
* @type {null | Type}
*/
get asType(): Type | null;
/**
* @type {null | Typed}
*/
get asTyped(): Typed | null;
/**
* @type {null | TypeClass}
*/
get asTypeClass(): TypeClass | null;
/**
* @type {boolean}
*/
get ready(): boolean;
/**
* @returns {string}
*/
toString(): string;
}
/**
* Used to represent all possible types whenever a TypeExpr throws an error (so type evaluation can continue in order to collect all type errors at once)
* @implements {DataType}
*/
export class AllType extends Common implements DataType {
/**
* @type {DataType}
*/
get asDataType(): DataType;
/**
* @type {Named}
*/
get asNamed(): Named;
/**
* @type {Type}
*/
get asType(): Type;
/**
* @type {string[]}
*/
get fieldNames(): string[];
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {string}
*/
get name(): string;
/**
* @type {string}
*/
get path(): string;
/**
* @type {TypeMembers}
*/
get typeMembers(): TypeMembers;
/**
* @returns {TypeSchema}
*/
toSchema(): TypeSchema;
/**
* @param {Site} site
* @param {InferenceMap} map
* @param {null | Type} type
* @returns {Type}
*/
infer(site: Site, map: InferenceMap, type: null | Type): Type;
/**
* @param {Type} other
* @returns {boolean}
*/
isBaseOf(other: Type): boolean;
/**
* @returns {Typed}
*/
toTyped(): Typed;
}
/**
* Untyped expressions result in AnyType
* @implements {DataType}
*/
export class AnyType extends Common implements DataType {
get fieldNames(): never[];
/**
* @type {string}
*/
get name(): string;
/**
* @type {string}
*/
get path(): string;
/**
* @type {Type}
*/
get asType(): Type;
/**
* @type {Named}
*/
get asNamed(): Named;
/**
* @type {DataType}
*/
get asDataType(): DataType;
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {TypeMembers}
*/
get typeMembers(): TypeMembers;
/**
* @returns {TypeSchema}
*/
toSchema(): TypeSchema;
/**
* @param {Site} site
* @param {InferenceMap} map
* @param {null | Type} type
* @returns {Type}
*/
infer(site: Site, map: InferenceMap, type: null | Type): Type;
/**
* @param {Type} other
* @returns {boolean}
*/
isBaseOf(other: Type): boolean;
/**
* @returns {Typed}
*/
toTyped(): Typed;
}
/**
* @internal
*/
export class ArgType {
/**
* @param {Word | undefined} name
* @param {Type} type
* @param {boolean} optional
*/
constructor(name: Word | undefined, type: Type, optional?: boolean);
/**
* @private
* @readonly
* @type {Word | undefined}
*/
private readonly _name;
/**
* @private
* @readonly
* @type {Type}
*/
private readonly _type;
/**
* @private
* @readonly
* @type {boolean}
*/
private readonly _optional;
/**
* @type {string}
*/
get name(): string;
/**
* @type {Type}
*/
get type(): Type;
/**
* @internal
* @param {Site} site
* @param {InferenceMap} map
* @param {null | Type} type
* @returns {ArgType}
*/
infer(site: Site, map: InferenceMap, type: null | Type): ArgType;
/**
* @param {ArgType} other
* @returns {boolean}
*/
isBaseOf(other: ArgType): boolean;
/**
* @returns {boolean}
*/
isNamed(): boolean;
/**
* @returns {boolean}
*/
isOptional(): boolean;
/**
* @returns {string}
*/
toString(): string;
}
/**
* Function type with arg types and a return type
* @implements {Type}
*/
export class FuncType extends Common implements Type {
/**
* @param {Type[] | ArgType[]} argTypes
* @param {Type} retType
*/
constructor(argTypes: Type[] | ArgType[], retType: Type);
/**
* @readonly
* @type {ArgType[]}
*/
readonly origArgTypes: ArgType[];
/**
* @private
* @readonly
* @type {Type}
*/
private readonly _retType;
/**
* @type {Type[]}
*/
get argTypes(): Type[];
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {number}
*/
get nArgs(): number;
/**
* @type {number}
*/
get nNonOptArgs(): number;
/**
* @type {number}
*/
get nOptArgs(): number;
/**
* @type {Type}
*/
get retType(): Type;
/**
* @type {TypeMembers}
*/
get typeMembers(): TypeMembers;
/**
* @type {Type}
*/
get asType(): Type;
/**
* Expand tuples in posArgs, if that matches argTypes better
* @param {Typed[]} posArgs
* @returns {Typed[]}
*/
expandTuplesInPosArgs(posArgs: Typed[]): Typed[];
/**
* Checks if arg types are valid.
* Throws errors if not valid. Returns the return type if valid.
* posArgs and namedArgs are mutated if implicit casting is viable
* @param {Site} site
* @param {Typed[]} origPosArgs - pos args with tuples, expanded internally
* @param {{[name: string]: Typed}} namedArgs
* @param {((argType: Type, targetType: Type) => (Type | undefined)) | undefined} viableCasts
* @returns {Type}
*/
checkCall(site: Site, origPosArgs: Typed[], namedArgs?: {
[name: string]: Typed;
}, viableCasts?: ((argType: Type, targetType: Type) => (Type | undefined)) | undefined): Type;
/**
* @internal
* @param {Site} site
* @param {InferenceMap} map
* @param {null | Type} type
* @returns {Type}
*/
infer(site: Site, map: InferenceMap, type: null | Type): Type;
/**
* @internal
* @param {Site} site
* @param {InferenceMap} map
* @param {Type[]} argTypes
* @returns {FuncType}
*/
inferArgs(site: Site, map: InferenceMap, argTypes: Type[]): FuncType;
/**
* Checks if any of 'this' argTypes or retType is same as Type.
* Only if this checks return true is the association allowed.
* @param {Site} site
* @param {Type} type
* @returns {boolean}
*/
isAssociated(site: Site, type: Type): boolean;
/**
* Checks if 'this' is a base type of another FuncType.
* The number of args needs to be the same.
* Each argType of the FuncType we are checking against needs to be the same or less specific (i.e. isBaseOf(this._argTypes[i]))
* The retType of 'this' needs to be the same or more specific
* @param {Type} other
* @returns {boolean}
*/
isBaseOf(other: Type): boolean;
/**
* Checks if the type of the first arg is the same as 'type'
* Also returns false if there are no args.
* For a method to be a valid instance member its first argument must also be named 'self', but that is checked elsewhere
* @param {Site} _site
* @param {Type} type
* @returns {boolean}
*/
isMaybeMethod(_site: Site, type: Type): boolean;
/**
* Throws an error if name isn't found
* @param {Site} site
* @param {string} name
* @returns {number}
*/
getNamedIndex(site: Site, name: string): number;
/**
* @returns {Typed}
*/
toTyped(): Typed;
}
/**
* @typedef {{
* name: string
* path?: string
* fieldNames?: string[]
* genInstanceMembers: (self: Type) => InstanceMembers
* genTypeMembers: (self: Type) => TypeMembers
* genTypeSchema?: (self: Type, parents: Set<string>) => TypeSchema
* }} GenericTypeProps
*/
/**
* Created by statements
* @implements {DataType}
*/
export class GenericType extends Common implements DataType {
/**
* @param {GenericTypeProps} props
*/
constructor({ name, path, fieldNames, genInstanceMembers, genTypeMembers, genTypeSchema }: GenericTypeProps);
/**
* @private
* @readonly
* @type {string}
*/
private readonly _name;
/**
* @private
* @readonly
* @type {string}
*/
private readonly _path;
/**
* @private
* @readonly
* @type {string[]}
*/
private readonly _fieldNames;
/**
* defer until needed
* @private
* @readonly
* @type {(self: Type) => InstanceMembers}
*/
private readonly _genInstanceMembers;
/**
* defer until needed
* @private
* @readonly
* @type {(self: Type) => TypeMembers}
*/
private readonly _genTypeMembers;
/**
* @private
* @type {InstanceMembers | undefined}
*/
private _instanceMembers;
/**
* @private
* @type {TypeMembers | undefined}
*/
private _typeMembers;
/**
* @private
* @readonly
* @type {((self: Type, parents: Set<string>) => TypeSchema) | undefined}
*/
private readonly _genTypeSchema;
/**
* @private
* @type {number}
*/
private _genDepth;
/**
* @type {DataType}
*/
get asDataType(): DataType;
/**
* @type {Named}
*/
get asNamed(): Named;
/**
* @type {Type}
*/
get asType(): Type;
/**
* @type {string[]}
*/
get fieldNames(): string[];
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {string}
*/
get name(): string;
/**
* @param {Set<string>} parents
* @returns {TypeSchema}
*/
toSchema(parents?: Set<string>): TypeSchema;
/**
* @type {string}
*/
get path(): string;
/**
* @type {TypeMembers}
*/
get typeMembers(): TypeMembers;
/**
* @param {Site} site
* @param {InferenceMap} map
*/
applyInternal(site: Site, map: InferenceMap): {
name: string;
path: string;
fieldNames: string[];
genInstanceMembers: (self: any) => InstanceMembers;
genTypeMembers: (self: any) => TypeMembers;
};
/**
* @param {Site} site
* @param {InferenceMap} map
* @param {null | Type} type
* @returns {Type}
*/
infer(site: Site, map: InferenceMap, type: null | Type): Type;
/**
* @param {string} name
* @param {string} path
* @returns {GenericType}
*/
changeNameAndPath(name: string, path: string): GenericType;
/**
* @param {Type} other
* @returns {boolean}
*/
isBaseOf(other: Type): boolean;
/**
* @returns {Typed}
*/
toTyped(): Typed;
}
/**
* @typedef {{
* name: string,
* path?: string,
* constrIndex: number,
* parentType: DataType,
* fieldNames?: string[],
* genInstanceMembers: (self: Type) => InstanceMembers,
* genTypeMembers?: (self: Type) => TypeMembers
* genTypeSchema: (self: Type, parents: Set<string>) => TypeSchema
* }} GenericEnumMemberTypeProps
*/
/**
* Created by statements
* @implements {EnumMemberType}
* @extends {GenericType}
*/
export class GenericEnumMemberType extends GenericType implements EnumMemberType {
/**
* @param {GenericEnumMemberTypeProps} props
*/
constructor({ name, path, constrIndex, parentType, fieldNames, genInstanceMembers, genTypeMembers, genTypeSchema }: GenericEnumMemberTypeProps);
/**
* @private
* @readonly
* @type {number}
*/
private readonly _constrIndex;
/**
* @private
* @readonly
* @type {DataType}
*/
private readonly _parentType;
/**
* @type {number}
*/
get constrIndex(): number;
/**
* @type {DataType}
*/
get parentType(): DataType;
/**
* @type {EnumMemberType}
*/
get asEnumMemberType(): EnumMemberType;
}
/**
* Type of return-value of functions that don't return anything (eg. assert, print, error)
* @internal
* @implements {Type}
*/
export class VoidType extends Common implements Type {
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {TypeMembers}
*/
get typeMembers(): TypeMembers;
/**
* @type {Type}
*/
get asType(): Type;
/**
*
* @param {Site} site
* @param {InferenceMap} map
* @param {null | Type} type
* @returns {Type}
*/
infer(site: Site, map: InferenceMap, type: null | Type): Type;
/**
* @param {Type} type
* @returns {boolean}
*/
isBaseOf(type: Type): boolean;
/**
* @returns {Typed}
*/
toTyped(): Typed;
}
/**
* A regular non-Func Instance. DataValues can always be compared, serialized, used in containers.
* @internal
* @implements {Instance}
*/
export class DataEntity extends Common implements Instance {
/**
* @param {DataType} type
*/
constructor(type: DataType);
/**
* @private
* @readonly
* @type {DataType}
*/
private readonly _type;
/**
* @type {string[]}
*/
get fieldNames(): string[];
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {Type}
*/
get type(): Type;
/**
* @type {Instance}
*/
get asInstance(): Instance;
/**
* @type {Typed}
*/
get asTyped(): Typed;
}
/**
* Type of special case of no-return value where execution can't continue.
* @internal
* @implements {Type}
*/
export class ErrorType extends VoidType implements Type {
}
/**
* Returned by an error()
* Special case of no-return-value that indicates that execution can't proceed.
* @internal
*/
export class ErrorEntity extends Common {
/**
* @type {string[]}
*/
get fieldNames(): string[];
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {Type}
*/
get type(): Type;
/**
* @type {Instance}
*/
get asInstance(): Instance;
/**
* @type {Typed}
*/
get asTyped(): Typed;
}
/**
* @internal
* @implements {Named}
*/
export class NamedEntity implements Named {
/**
* @param {string} name
* @param {string} path
* @param {EvalEntity} entity
*/
constructor(name: string, path: string, entity: EvalEntity);
/**
* @private
* @readonly
* @type {string}
*/
private readonly _name;
/**
* @private
* @readonly
* @type {string}
*/
private readonly _path;
/**
* @private
* @readonly
* @type {EvalEntity}
*/
private readonly _entity;
/**
* @type {null | DataType}
*/
get asDataType(): DataType | null;
/**
* @type {null | EnumMemberType}
*/
get asEnumMemberType(): EnumMemberType | null;
/**
* @type {null | Func}
*/
get asFunc(): Func | null;
/**
* @type {null | Instance}
*/
get asInstance(): Instance | null;
/**
* @type {Named}
*/
get asNamed(): Named;
/**
* @type {null | Namespace}
*/
get asNamespace(): Namespace | null;
/**
* @type {null | Parametric}
*/
get asParametric(): Parametric | null;
/**
* @type {null | Type}
*/
get asType(): Type | null;
/**
* @type {null | Typed}
*/
get asTyped(): Typed | null;
/**
* @type {null | TypeClass}
*/
get asTypeClass(): TypeClass | null;
/**
* @type {string}
*/
get name(): string;
/**
* @type {string}
*/
get path(): string;
/**
* @returns {string}
*/
toString(): string;
}
/**
* A callable Instance.
* @internal
* @implements {Func}
*/
export class FuncEntity extends Common implements Func {
/**
* @param {FuncType} type
*/
constructor(type: FuncType);
/**
* @private
* @readonly
* @type {FuncType}
*/
private readonly _type;
/**
* @type {Type}
*/
get type(): Type;
/**
* Returns the underlying FuncType directly.
* @type {FuncType}
*/
get funcType(): FuncType;
/**
* @type {Func}
*/
get asFunc(): Func;
/**
* @type {Typed}
*/
get asTyped(): Typed;
/**
* @param {Site} site
* @param {Typed[]} args
* @param {{[name: string]: Typed}} namedArgs
* @param {ViableCasts | undefined} viableCasts
* @returns {Typed}
*/
call(site: Site, args: Typed[], namedArgs?: {
[name: string]: Typed;
}, viableCasts?: ViableCasts | undefined): Typed;
}
/**
* @internal
* @implements {Typed}
*/
export class TypedEntity extends Common implements Typed {
/**
* @param {Type} type
*/
constructor(type: Type);
/**
* @private
* @readonly
* @type {Type}
*/
private readonly _type;
/**
* @returns {Typed}
*/
get asTyped(): Typed;
/**
* @type {Type}
*/
get type(): Type;
}
/**
* Returned by functions that don't return anything (eg. assert, error, print)
* @internal
* @implements {Instance}
*/
export class VoidEntity extends Common implements Instance {
/**
* @type {string[]}
*/
get fieldNames(): string[];
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {Type}
*/
get type(): Type;
/**
* @type {Instance}
*/
get asInstance(): Instance;
/**
* @type {Typed}
*/
get asTyped(): Typed;
}
/**
* @implements {Instance}
*/
export class AnyEntity extends Common implements Instance {
/**
* @type {string[]}
*/
get fieldNames(): string[];
/**
* @type {InstanceMembers}
*/
get instanceMembers(): InstanceMembers;
/**
* @type {Type}
*/
get type(): Type;
/**
* @type {Instance}
*/
get asInstance(): Instance;
/**
* @type {Typed}
*/
get asTyped(): Typed;
}
/**
* @implements {Namespace}
*/
export class ModuleNamespace extends Common implements Namespace {
/**
* @param {string} name
* @param {NamespaceMembers} members
*/
constructor(name: string, members: NamespaceMembers);
/**
* @readonly
* @type {string}
*/
readonly name: string;
/**
* @private
* @readonly
* @type {NamespaceMembers}
*/
private readonly _members;
/**
* @type {NamespaceMembers}
*/
get namespaceMembers(): NamespaceMembers;
/**
* @type {Namespace}
*/
get asNamespace(): Namespace;
}
/**
* @implements {Named}
* @implements {Namespace}
*/
export class NamedNamespace extends ModuleNamespace implements Named, Namespace {
/**
* @param {string} name
* @param {string} path
* @param {NamespaceMembers} members
*/
constructor(name: string, path: string, members: NamespaceMembers);
/**
* @readonly
* @type {string}
*/
readonly path: string;
/**
* @type {Named}
*/
get asNamed(): Named;
}
export type ParameterI = {
name: string;
typeClass: TypeClass;
};
export type InferenceMap = Map<ParameterI, Type>;
export type DataType = Named & Type & {
asDataType: DataType;
fieldNames: string[];
toSchema(parents?: Set<string>): TypeSchema;
ready: boolean;
};
export type EnumMemberType = DataType & {
asEnumMemberType: EnumMemberType;
constrIndex: number;
parentType: DataType;
};
/**
* EvalEntities assert themselves
*/
export type EvalEntity = {
asDataType: (null | DataType);
asEnumMemberType: (null | EnumMemberType);
asFunc: (null | Func);
asInstance: (null | Instance);
asNamed: (null | Named);
asNamespace: (null | Namespace);
asParametric: (null | Parametric);
asType: (null | Type);
asTyped: (null | Typed);
asTypeClass: (null | TypeClass);
toString(): string;
};
export type Func = Typed & {
asFunc: Func;
funcType: FuncType;
call(site: Site, args: Typed[], namedArgs?: {
[name: string]: Typed;
}, viableCasts?: ViableCasts): Typed;
};
export type Instance = Typed & {
asInstance: Instance;
fieldNames: string[];
instanceMembers: InstanceMembers;
};
export type Named = EvalEntity & {
asNamed: Named;
name: string;
path: string;
};
export type Namespace = EvalEntity & {
asNamespace: Namespace;
namespaceMembers: NamespaceMembers;
};
export type Parametric = EvalEntity & {
asParametric: Parametric;
typeClasses: TypeClass[];
apply(types: Type[], site?: Site): EvalEntity;
inferCall(site: Site, args: Typed[], namedArgs?: {
[name: string]: Typed;
}, paramTypes?: Type[]): Func;
infer(site: Site, map: InferenceMap): Parametric;
};
export type Type = EvalEntity & {
asType: Type;
instanceMembers: InstanceMembers;
typeMembers: TypeMembers;
isBaseOf(type: Type): boolean;
infer(site: Site, map: InferenceMap, type: null | Type): Type;
toTyped(): Typed;
isParametric(): boolean;
};
export type Typed = EvalEntity & {
asTyped: Typed;
type: Type;
};
export type TypeClass = EvalEntity & {
asTypeClass: TypeClass;
genInstanceMembers(impl: Type): TypeClassMembers;
genTypeMembers(impl: Type): TypeClassMembers;
isImplementedBy(type: Type): boolean;
toType(name: string, path: string, parameter?: null | ParameterI): Type;
};
export type InstanceMembers = {
[name: string]: (Parametric | Type);
};
export type NamespaceMembers = {
[name: string]: EvalEntity;
};
export type TypeMembers = {
[name: string]: (Parametric | Type | Typed);
};
export type TypeClassMembers = {
[name: string]: Type;
};
export type StructTypeSchema = import("@helios-lang/type-utils").StructTypeSchema;
export type FieldTypeSchema = import("@helios-lang/type-utils").FieldTypeSchema;
export type TypeSchema = import("@helios-lang/type-utils").TypeSchema;
export type VariantTypeSchema = import("@helios-lang/type-utils").VariantTypeSchema;
export type UplcData = import("@helios-lang/uplc").UplcData;
export type ViableCasts = (argType: Type, targetType: Type) => (Type | undefined);
export type ExpandTupleCallback = (type: Type) => (Type[] | undefined);
export type MakeListCallback = (type: Type) => DataType;
export type MakeMapCallback = (keyType: Type, valueType: Type) => DataType;
export type GenericTypeProps = {
name: string;
path?: string;
fieldNames?: string[];
genInstanceMembers: (self: Type) => InstanceMembers;
genTypeMembers: (self: Type) => TypeMembers;
genTypeSchema?: (self: Type, parents: Set<string>) => TypeSchema;
};
export type GenericEnumMemberTypeProps = {
name: string;
path?: string;
constrIndex: number;
parentType: DataType;
fieldNames?: string[];
genInstanceMembers: (self: Type) => InstanceMembers;
genTypeMembers?: (self: Type) => TypeMembers;
genTypeSchema: (self: Type, parents: Set<string>) => TypeSchema;
};
import type { Site } from "@helios-lang/compiler-utils";
import type { Word } from "@helios-lang/compiler-utils";
//# sourceMappingURL=common.d.ts.map