@soundscript/soundscript 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +10 -0
- package/async.d.ts +81 -0
- package/async.js +214 -0
- package/async.js.map +1 -0
- package/bin/soundscript.js +54 -0
- package/codec.d.ts +31 -0
- package/codec.js +31 -0
- package/codec.js.map +1 -0
- package/compare.d.ts +28 -0
- package/compare.js +121 -0
- package/compare.js.map +1 -0
- package/decode.d.ts +84 -0
- package/decode.js +249 -0
- package/decode.js.map +1 -0
- package/encode.d.ts +98 -0
- package/encode.js +128 -0
- package/encode.js.map +1 -0
- package/experimental/component.d.ts +40 -0
- package/experimental/component.js +46 -0
- package/experimental/component.js.map +1 -0
- package/experimental/css.d.ts +16 -0
- package/experimental/css.js +10 -0
- package/experimental/css.js.map +1 -0
- package/experimental/debug.d.ts +2 -0
- package/experimental/debug.js +10 -0
- package/experimental/debug.js.map +1 -0
- package/experimental/graphql.d.ts +16 -0
- package/experimental/graphql.js +10 -0
- package/experimental/graphql.js.map +1 -0
- package/experimental/sql.d.ts +22 -0
- package/experimental/sql.js +24 -0
- package/experimental/sql.js.map +1 -0
- package/failures.d.ts +23 -0
- package/failures.js +42 -0
- package/failures.js.map +1 -0
- package/hash.d.ts +34 -0
- package/hash.js +116 -0
- package/hash.js.map +1 -0
- package/hkt.d.ts +40 -0
- package/hkt.js +4 -0
- package/hkt.js.map +1 -0
- package/index.d.ts +9 -0
- package/index.js +16 -0
- package/index.js.map +1 -0
- package/json.d.ts +98 -0
- package/json.js +638 -0
- package/json.js.map +1 -0
- package/match.d.ts +11 -0
- package/match.js +14 -0
- package/match.js.map +1 -0
- package/package.json +153 -0
- package/result.d.ts +52 -0
- package/result.js +104 -0
- package/result.js.map +1 -0
- package/soundscript/async.sts +315 -0
- package/soundscript/codec.sts +75 -0
- package/soundscript/compare.sts +159 -0
- package/soundscript/decode.sts +382 -0
- package/soundscript/encode.sts +254 -0
- package/soundscript/experimental/component.sts +69 -0
- package/soundscript/experimental/css.sts +28 -0
- package/soundscript/experimental/debug.sts +10 -0
- package/soundscript/experimental/graphql.sts +28 -0
- package/soundscript/experimental/sql.sts +53 -0
- package/soundscript/failures.sts +64 -0
- package/soundscript/hash.sts +196 -0
- package/soundscript/hkt.sts +41 -0
- package/soundscript/index.sts +23 -0
- package/soundscript/json.sts +824 -0
- package/soundscript/match.sts +26 -0
- package/soundscript/result.sts +179 -0
- package/soundscript/thunk.sts +15 -0
- package/soundscript/typeclasses.sts +167 -0
- package/thunk.d.ts +2 -0
- package/thunk.js +10 -0
- package/thunk.js.map +1 -0
- package/typeclasses.d.ts +57 -0
- package/typeclasses.js +78 -0
- package/typeclasses.js.map +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
function macroRuntimeError(name) {
|
|
2
|
+
throw new Error(`${name}(...) is a Soundscript macro and should be removed during Soundscript expansion.`);
|
|
3
|
+
}
|
|
4
|
+
export function state(_value) {
|
|
5
|
+
return macroRuntimeError('state');
|
|
6
|
+
}
|
|
7
|
+
export function awaited(_promise, _pending, _fulfilled, _rejected) {
|
|
8
|
+
return macroRuntimeError('awaited');
|
|
9
|
+
}
|
|
10
|
+
export function boundary(_render, _fallback) {
|
|
11
|
+
return macroRuntimeError('boundary');
|
|
12
|
+
}
|
|
13
|
+
export function context() {
|
|
14
|
+
return macroRuntimeError('context');
|
|
15
|
+
}
|
|
16
|
+
export function dispatch(_type, _detail) {
|
|
17
|
+
return macroRuntimeError('dispatch');
|
|
18
|
+
}
|
|
19
|
+
export function derived(_compute) {
|
|
20
|
+
return macroRuntimeError('derived');
|
|
21
|
+
}
|
|
22
|
+
export function effect(_callback) {
|
|
23
|
+
return macroRuntimeError('effect');
|
|
24
|
+
}
|
|
25
|
+
export function onMount(_callback) {
|
|
26
|
+
return macroRuntimeError('onMount');
|
|
27
|
+
}
|
|
28
|
+
export function prop(_value) {
|
|
29
|
+
return macroRuntimeError('prop');
|
|
30
|
+
}
|
|
31
|
+
export function provide(_context, _value, _content) {
|
|
32
|
+
return macroRuntimeError('provide');
|
|
33
|
+
}
|
|
34
|
+
export function useContext(_value) {
|
|
35
|
+
return macroRuntimeError('useContext');
|
|
36
|
+
}
|
|
37
|
+
export function useStore(_value) {
|
|
38
|
+
return macroRuntimeError('useStore');
|
|
39
|
+
}
|
|
40
|
+
export function component(_value) {
|
|
41
|
+
return macroRuntimeError('component');
|
|
42
|
+
}
|
|
43
|
+
export function store(_value) {
|
|
44
|
+
return macroRuntimeError('store');
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../soundscript/experimental/component.sts"],"names":[],"mappings":"AAAA,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,kFAAkF,CAC1F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAI,MAAS;IAChC,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,OAAO,CACrB,QAAwB,EACxB,QAA+C,EAC/C,UAAyC,EACzC,SAA8C;IAE9C,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,OAA2B,EAC3B,SAA6C;IAE7C,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAI,KAAa,EAAE,OAAW;IACpD,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,QAAiB;IAC1C,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,MAAM,CAAI,SAAkB;IAC1C,OAAO,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,SAAkB;IAC3C,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,IAAI,CAAI,MAAU;IAChC,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,OAAO,CAAO,QAAiB,EAAE,MAAS,EAAE,QAAuB;IACjF,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,UAAU,CAAI,MAAe;IAC3C,OAAO,iBAAiB,CAAC,YAAY,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,QAAQ,CAAI,MAAS;IACnC,OAAO,iBAAiB,CAAC,UAAU,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,SAAS,CAAI,MAAS;IACpC,OAAO,iBAAiB,CAAC,WAAW,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,KAAK,CAAI,MAAS;IAChC,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC","sourcesContent":["function macroRuntimeError(name: string): never {\n throw new Error(\n `${name}(...) is a Soundscript macro and should be removed during Soundscript expansion.`,\n );\n}\n\nexport function state<T>(_value: T): never {\n return macroRuntimeError('state');\n}\n\nexport function awaited<T, PendingResult, FulfilledResult, RejectedResult = never>(\n _promise: PromiseLike<T>,\n _pending: PendingResult | (() => PendingResult),\n _fulfilled: (value: T) => FulfilledResult,\n _rejected?: (error: unknown) => RejectedResult,\n): never {\n return macroRuntimeError('awaited');\n}\n\nexport function boundary<RenderResult, FallbackResult>(\n _render: () => RenderResult,\n _fallback: (error: unknown) => FallbackResult,\n): never {\n return macroRuntimeError('boundary');\n}\n\nexport function context<T>(): never {\n return macroRuntimeError('context');\n}\n\nexport function dispatch<T>(_type: string, _detail?: T): never {\n return macroRuntimeError('dispatch');\n}\n\nexport function derived<T>(_compute: () => T): never {\n return macroRuntimeError('derived');\n}\n\nexport function effect<T>(_callback: () => T): never {\n return macroRuntimeError('effect');\n}\n\nexport function onMount<T>(_callback: () => T): never {\n return macroRuntimeError('onMount');\n}\n\nexport function prop<T>(_value?: T): never {\n return macroRuntimeError('prop');\n}\n\nexport function provide<T, R>(_context: unknown, _value: T, _content: R | (() => R)): never {\n return macroRuntimeError('provide');\n}\n\nexport function useContext<T>(_value: unknown): never {\n return macroRuntimeError('useContext');\n}\n\nexport function useStore<T>(_value: T): never {\n return macroRuntimeError('useStore');\n}\n\nexport function component<T>(_value: T): never {\n return macroRuntimeError('component');\n}\n\nexport function store<T>(_value: T): never {\n return macroRuntimeError('store');\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface CssRawFragment {
|
|
2
|
+
readonly __cssKind: 'raw';
|
|
3
|
+
readonly text: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface CssTemplate {
|
|
7
|
+
readonly text: string;
|
|
8
|
+
readonly values: readonly unknown[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CssTag {
|
|
12
|
+
(strings: TemplateStringsArray, ...values: readonly unknown[]): CssTemplate;
|
|
13
|
+
raw(text: string): CssRawFragment;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const css: CssTag;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const cssTag = Object.assign((strings, ...values) => ({
|
|
2
|
+
text: String.raw({ raw: strings }, ...values.map(String)),
|
|
3
|
+
values: [...values],
|
|
4
|
+
}), {
|
|
5
|
+
raw(text) {
|
|
6
|
+
return { __cssKind: 'raw', text };
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
export const css = cssTag;
|
|
10
|
+
//# sourceMappingURL=css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../soundscript/experimental/css.sts"],"names":[],"mappings":"AAeA,MAAM,MAAM,GAAW,MAAM,CAAC,MAAM,CAClC,CAAC,OAA6B,EAAE,GAAG,MAA0B,EAAe,EAAE,CAAC,CAAC;IAC9E,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACzD,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;CACpB,CAAC,EACF;IACE,GAAG,CAAC,IAAY;QACd,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;CACF,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC","sourcesContent":["export interface CssRawFragment {\n readonly __cssKind: 'raw';\n readonly text: string;\n}\n\nexport interface CssTemplate {\n readonly text: string;\n readonly values: readonly unknown[];\n}\n\nexport interface CssTag {\n (strings: TemplateStringsArray, ...values: readonly unknown[]): CssTemplate;\n raw(text: string): CssRawFragment;\n}\n\nconst cssTag: CssTag = Object.assign(\n (strings: TemplateStringsArray, ...values: readonly unknown[]): CssTemplate => ({\n text: String.raw({ raw: strings }, ...values.map(String)),\n values: [...values],\n }),\n {\n raw(text: string): CssRawFragment {\n return { __cssKind: 'raw', text };\n },\n },\n);\n\nexport const css = cssTag;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../soundscript/experimental/debug.sts"],"names":[],"mappings":"AAAA,MAAM,UAAU,MAAM,CAAC,SAAkB,EAAE,OAAO,GAAG,mBAAmB;IACtE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,CAAI,KAAQ;IAC7B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["export function assert(condition: unknown, message = 'Assertion failed.'): asserts condition {\n if (!condition) {\n throw new Error(message);\n }\n}\n\nexport function log<T>(value: T): T {\n console.log(value);\n return value;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface GraphqlRawFragment {
|
|
2
|
+
readonly __graphqlKind: 'raw';
|
|
3
|
+
readonly text: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface GraphqlQuery {
|
|
7
|
+
readonly query: string;
|
|
8
|
+
readonly values: readonly unknown[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface GraphqlTag {
|
|
12
|
+
(strings: TemplateStringsArray, ...values: readonly unknown[]): GraphqlQuery;
|
|
13
|
+
raw(text: string): GraphqlRawFragment;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const graphql: GraphqlTag;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const graphqlTag = Object.assign((strings, ...values) => ({
|
|
2
|
+
query: String.raw({ raw: strings }, ...values.map(String)),
|
|
3
|
+
values: [...values],
|
|
4
|
+
}), {
|
|
5
|
+
raw(text) {
|
|
6
|
+
return { __graphqlKind: 'raw', text };
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
export const graphql = graphqlTag;
|
|
10
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../soundscript/experimental/graphql.sts"],"names":[],"mappings":"AAeA,MAAM,UAAU,GAAe,MAAM,CAAC,MAAM,CAC1C,CAAC,OAA6B,EAAE,GAAG,MAA0B,EAAgB,EAAE,CAAC,CAAC;IAC/E,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;CACpB,CAAC,EACF;IACE,GAAG,CAAC,IAAY;QACd,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACxC,CAAC;CACF,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC","sourcesContent":["export interface GraphqlRawFragment {\n readonly __graphqlKind: 'raw';\n readonly text: string;\n}\n\nexport interface GraphqlQuery {\n readonly query: string;\n readonly values: readonly unknown[];\n}\n\nexport interface GraphqlTag {\n (strings: TemplateStringsArray, ...values: readonly unknown[]): GraphqlQuery;\n raw(text: string): GraphqlRawFragment;\n}\n\nconst graphqlTag: GraphqlTag = Object.assign(\n (strings: TemplateStringsArray, ...values: readonly unknown[]): GraphqlQuery => ({\n query: String.raw({ raw: strings }, ...values.map(String)),\n values: [...values],\n }),\n {\n raw(text: string): GraphqlRawFragment {\n return { __graphqlKind: 'raw', text };\n },\n },\n);\n\nexport const graphql = graphqlTag;\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SqlQuery {
|
|
2
|
+
readonly text: string;
|
|
3
|
+
readonly params: readonly unknown[];
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface SqlIdentifier {
|
|
7
|
+
readonly __sqlKind: 'identifier';
|
|
8
|
+
readonly name: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface SqlRawFragment {
|
|
12
|
+
readonly __sqlKind: 'raw';
|
|
13
|
+
readonly text: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SqlTag {
|
|
17
|
+
(strings: TemplateStringsArray, ...values: readonly unknown[]): SqlQuery;
|
|
18
|
+
ident(name: string): SqlIdentifier;
|
|
19
|
+
raw(text: string): SqlRawFragment;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const sql: SqlTag;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function buildSqlQuery(strings, values) {
|
|
2
|
+
let text = '';
|
|
3
|
+
for (let index = 0; index < strings.length; index += 1) {
|
|
4
|
+
text += strings[index] ?? '';
|
|
5
|
+
if (index < values.length) {
|
|
6
|
+
text += `$${index + 1}`;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
text,
|
|
11
|
+
params: [...values],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
const sqlTag = ((strings, ...values) => buildSqlQuery(strings, values));
|
|
15
|
+
sqlTag.ident = (name) => ({
|
|
16
|
+
__sqlKind: 'identifier',
|
|
17
|
+
name,
|
|
18
|
+
});
|
|
19
|
+
sqlTag.raw = (text) => ({
|
|
20
|
+
__sqlKind: 'raw',
|
|
21
|
+
text,
|
|
22
|
+
});
|
|
23
|
+
export const sql = sqlTag;
|
|
24
|
+
//# sourceMappingURL=sql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql.js","sourceRoot":"","sources":["../soundscript/experimental/sql.sts"],"names":[],"mappings":"AAqBA,SAAS,aAAa,CACpB,OAA6B,EAC7B,MAA0B;IAE1B,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACvD,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAC7B,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;YAC1B,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI;QACJ,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,CAAC,OAA6B,EAAE,GAAG,MAA0B,EAAE,EAAE,CAC/E,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAW,CAAC;AAE5C,MAAM,CAAC,KAAK,GAAG,CAAC,IAAY,EAAiB,EAAE,CAAC,CAAC;IAC/C,SAAS,EAAE,YAAY;IACvB,IAAI;CACL,CAAC,CAAC;AAEH,MAAM,CAAC,GAAG,GAAG,CAAC,IAAY,EAAkB,EAAE,CAAC,CAAC;IAC9C,SAAS,EAAE,KAAK;IAChB,IAAI;CACL,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC","sourcesContent":["export interface SqlQuery {\n readonly text: string;\n readonly params: readonly unknown[];\n}\n\nexport interface SqlIdentifier {\n readonly __sqlKind: 'identifier';\n readonly name: string;\n}\n\nexport interface SqlRawFragment {\n readonly __sqlKind: 'raw';\n readonly text: string;\n}\n\nexport interface SqlTag {\n (strings: TemplateStringsArray, ...values: readonly unknown[]): SqlQuery;\n ident(name: string): SqlIdentifier;\n raw(text: string): SqlRawFragment;\n}\n\nfunction buildSqlQuery(\n strings: TemplateStringsArray,\n values: readonly unknown[],\n): SqlQuery {\n let text = '';\n for (let index = 0; index < strings.length; index += 1) {\n text += strings[index] ?? '';\n if (index < values.length) {\n text += `$${index + 1}`;\n }\n }\n\n return {\n text,\n params: [...values],\n };\n}\n\nconst sqlTag = ((strings: TemplateStringsArray, ...values: readonly unknown[]) =>\n buildSqlQuery(strings, values)) as SqlTag;\n\nsqlTag.ident = (name: string): SqlIdentifier => ({\n __sqlKind: 'identifier',\n name,\n});\n\nsqlTag.raw = (text: string): SqlRawFragment => ({\n __sqlKind: 'raw',\n text,\n});\n\nexport const sql = sqlTag;\n"]}
|
package/failures.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type ErrorFrame = {
|
|
2
|
+
readonly column: number;
|
|
3
|
+
readonly file: string;
|
|
4
|
+
readonly fn?: string;
|
|
5
|
+
readonly line: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export class Failure {
|
|
9
|
+
readonly cause?: unknown;
|
|
10
|
+
readonly message: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly trace: readonly ErrorFrame[];
|
|
13
|
+
constructor(
|
|
14
|
+
message?: string,
|
|
15
|
+
options?: {
|
|
16
|
+
cause?: unknown;
|
|
17
|
+
trace?: readonly ErrorFrame[];
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
withFrame(frame: ErrorFrame): this;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function normalizeThrown(value: unknown): Error;
|
package/failures.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export class Failure {
|
|
2
|
+
constructor(message = '', options = {}) {
|
|
3
|
+
this.name = new.target.name;
|
|
4
|
+
this.message = message;
|
|
5
|
+
if ('cause' in options) {
|
|
6
|
+
this.cause = options.cause;
|
|
7
|
+
}
|
|
8
|
+
this.trace = options.trace ?? [];
|
|
9
|
+
}
|
|
10
|
+
withFrame(frame) {
|
|
11
|
+
const prototype = Object.getPrototypeOf(this);
|
|
12
|
+
const clone = (prototype === null ? Object.create(null) : Object.create(prototype));
|
|
13
|
+
Object.defineProperties(clone, Object.getOwnPropertyDescriptors(this));
|
|
14
|
+
Object.defineProperty(clone, 'trace', {
|
|
15
|
+
configurable: true,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
writable: false,
|
|
18
|
+
value: [...this.trace, frame],
|
|
19
|
+
});
|
|
20
|
+
return clone;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function normalizeThrown(value) {
|
|
24
|
+
if (value instanceof Error) {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
const details = typeof value === 'object' && value !== null
|
|
28
|
+
? value
|
|
29
|
+
: undefined;
|
|
30
|
+
const message = typeof details?.message === 'string'
|
|
31
|
+
? details.message
|
|
32
|
+
: 'Non-Error thrown value.';
|
|
33
|
+
const error = new Error(message, { cause: value });
|
|
34
|
+
if (typeof details?.name === 'string') {
|
|
35
|
+
error.name = details.name;
|
|
36
|
+
}
|
|
37
|
+
if (typeof details?.stack === 'string') {
|
|
38
|
+
error.stack = details.stack;
|
|
39
|
+
}
|
|
40
|
+
return error;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=failures.js.map
|
package/failures.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"failures.js","sourceRoot":"","sources":["./soundscript/failures.sts"],"names":[],"mappings":"AAOA,MAAM,OAAO,OAAO;IAMlB,YACE,OAAO,GAAG,EAAE,EACZ,UAGI,EAAE;QAEN,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;YACvB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC7B,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;IACnC,CAAC;IAED,SAAS,CAAC,KAAiB;QACzB,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,IAAc,CAAC,CAAC;QACxD,MAAM,KAAK,GAAG,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAS,CAAC;QAC5F,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;QACvE,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE;YACpC,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,IAAI;YAChB,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC;SAC9B,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QACzD,CAAC,CAAC,KAA+D;QACjE,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,OAAO,GAAG,OAAO,OAAO,EAAE,OAAO,KAAK,QAAQ;QAClD,CAAC,CAAC,OAAO,CAAC,OAAO;QACjB,CAAC,CAAC,yBAAyB,CAAC;IAC9B,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAEnD,IAAI,OAAO,OAAO,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC5B,CAAC;IACD,IAAI,OAAO,OAAO,EAAE,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvC,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC9B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["export type ErrorFrame = {\n readonly column: number;\n readonly file: string;\n readonly fn?: string;\n readonly line: number;\n};\n\nexport class Failure {\n readonly cause?: unknown;\n readonly message: string;\n readonly name: string;\n readonly trace: readonly ErrorFrame[];\n\n constructor(\n message = '',\n options: {\n cause?: unknown;\n trace?: readonly ErrorFrame[];\n } = {},\n ) {\n this.name = new.target.name;\n this.message = message;\n if ('cause' in options) {\n this.cause = options.cause;\n }\n this.trace = options.trace ?? [];\n }\n\n withFrame(frame: ErrorFrame): this {\n const prototype = Object.getPrototypeOf(this as object);\n const clone = (prototype === null ? Object.create(null) : Object.create(prototype)) as this;\n Object.defineProperties(clone, Object.getOwnPropertyDescriptors(this));\n Object.defineProperty(clone, 'trace', {\n configurable: true,\n enumerable: true,\n writable: false,\n value: [...this.trace, frame],\n });\n return clone;\n }\n}\n\nexport function normalizeThrown(value: unknown): Error {\n if (value instanceof Error) {\n return value;\n }\n\n const details = typeof value === 'object' && value !== null\n ? value as { message?: unknown; name?: unknown; stack?: unknown }\n : undefined;\n const message = typeof details?.message === 'string'\n ? details.message\n : 'Non-Error thrown value.';\n const error = new Error(message, { cause: value });\n\n if (typeof details?.name === 'string') {\n error.name = details.name;\n }\n if (typeof details?.stack === 'string') {\n error.stack = details.stack;\n }\n\n return error;\n}\n"]}
|
package/hash.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Eq } from '@soundscript/soundscript/compare';
|
|
2
|
+
import type { Option, Result } from '@soundscript/soundscript/result';
|
|
3
|
+
|
|
4
|
+
export type HashCode = number;
|
|
5
|
+
|
|
6
|
+
export interface Hash<T> {
|
|
7
|
+
hash(value: T): HashCode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface HashEq<T> extends Hash<T>, Eq<T> {}
|
|
11
|
+
|
|
12
|
+
type HashEqValue<THashEq> = THashEq extends HashEq<infer TValue> ? TValue : never;
|
|
13
|
+
|
|
14
|
+
export function fromHashEq<T>(
|
|
15
|
+
hash: (value: T) => HashCode,
|
|
16
|
+
equals: (left: T, right: T) => boolean,
|
|
17
|
+
): HashEq<T>;
|
|
18
|
+
export function contramap<A, B>(
|
|
19
|
+
hashEq: HashEq<A>,
|
|
20
|
+
project: (value: B) => A,
|
|
21
|
+
): HashEq<B>;
|
|
22
|
+
export function lazyHashEq<T>(getHashEq: () => HashEq<T>): HashEq<T>;
|
|
23
|
+
export function arrayHash<T>(itemHash: HashEq<T>): HashEq<readonly T[]>;
|
|
24
|
+
export function tupleHash<const THashEqs extends readonly HashEq<unknown>[]>(
|
|
25
|
+
...elements: THashEqs
|
|
26
|
+
): HashEq<{ readonly [K in keyof THashEqs]: HashEqValue<THashEqs[K]> }>;
|
|
27
|
+
export function optionHash<T>(itemHash: HashEq<T>): HashEq<Option<T>>;
|
|
28
|
+
export function resultHash<T, E>(okHash: HashEq<T>, errHash: HashEq<E>): HashEq<Result<T, E>>;
|
|
29
|
+
|
|
30
|
+
export const stringHash: HashEq<string>;
|
|
31
|
+
export const numberHash: HashEq<number>;
|
|
32
|
+
export const booleanHash: HashEq<boolean>;
|
|
33
|
+
export const bigintHash: HashEq<bigint>;
|
|
34
|
+
export function combineHashes(...hashes: readonly HashCode[]): HashCode;
|
package/hash.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export function fromHashEq(hash, equals) {
|
|
2
|
+
return {
|
|
3
|
+
hash(value) {
|
|
4
|
+
return normalizeHashCode(hash(value));
|
|
5
|
+
},
|
|
6
|
+
equals,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function contramap(hashEq, project) {
|
|
10
|
+
return fromHashEq((value) => hashEq.hash(project(value)), (left, right) => hashEq.equals(project(left), project(right)));
|
|
11
|
+
}
|
|
12
|
+
export function lazyHashEq(getHashEq) {
|
|
13
|
+
return fromHashEq((value) => getHashEq().hash(value), (left, right) => getHashEq().equals(left, right));
|
|
14
|
+
}
|
|
15
|
+
export function arrayHash(itemHash) {
|
|
16
|
+
return fromHashEq((value) => combineHashes(...value.map((entry) => itemHash.hash(entry))), (left, right) => {
|
|
17
|
+
if (left.length !== right.length) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
for (let index = 0; index < left.length; index += 1) {
|
|
21
|
+
if (!itemHash.equals(left[index], right[index])) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export function tupleHash(...elements) {
|
|
29
|
+
return fromHashEq((value) => {
|
|
30
|
+
const values = value;
|
|
31
|
+
if (values.length !== elements.length) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
return combineHashes(...elements.map((elementHash, index) => elementHash.hash(values[index])));
|
|
35
|
+
}, (left, right) => {
|
|
36
|
+
const leftValues = left;
|
|
37
|
+
const rightValues = right;
|
|
38
|
+
if (leftValues.length !== elements.length || rightValues.length !== elements.length) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
for (let index = 0; index < elements.length; index += 1) {
|
|
42
|
+
const elementHash = elements[index];
|
|
43
|
+
if (!elementHash) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (!elementHash.equals(leftValues[index], rightValues[index])) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function optionHash(itemHash) {
|
|
54
|
+
return fromHashEq((value) => value.tag === 'ok'
|
|
55
|
+
? combineHashes(stringHash.hash('ok'), itemHash.hash(value.value))
|
|
56
|
+
: stringHash.hash('err'), (left, right) => {
|
|
57
|
+
if (left.tag !== right.tag) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
if (left.tag === 'ok' && right.tag === 'ok') {
|
|
61
|
+
return itemHash.equals(left.value, right.value);
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
export function resultHash(okHash, errHash) {
|
|
67
|
+
return fromHashEq((value) => value.tag === 'ok'
|
|
68
|
+
? combineHashes(stringHash.hash('ok'), okHash.hash(value.value))
|
|
69
|
+
: combineHashes(stringHash.hash('err'), errHash.hash(value.error)), (left, right) => {
|
|
70
|
+
if (left.tag !== right.tag) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (left.tag === 'ok' && right.tag === 'ok') {
|
|
74
|
+
return okHash.equals(left.value, right.value);
|
|
75
|
+
}
|
|
76
|
+
if (left.tag === 'err' && right.tag === 'err') {
|
|
77
|
+
return errHash.equals(left.error, right.error);
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export const stringHash = fromHashEq(hashString, (left, right) => left === right);
|
|
83
|
+
export const numberHash = fromHashEq((value) => hashString(normalizeNumberKey(value)), (left, right) => left === right || (Number.isNaN(left) && Number.isNaN(right)));
|
|
84
|
+
export const booleanHash = fromHashEq((value) => value ? 1 : 0, (left, right) => left === right);
|
|
85
|
+
export const bigintHash = fromHashEq((value) => hashString(value.toString()), (left, right) => left === right);
|
|
86
|
+
export function combineHashes(...hashes) {
|
|
87
|
+
let hash = 0;
|
|
88
|
+
for (const value of hashes) {
|
|
89
|
+
hash = Math.imul(hash ^ normalizeHashCode(value), 0x01000193);
|
|
90
|
+
}
|
|
91
|
+
return normalizeHashCode(hash);
|
|
92
|
+
}
|
|
93
|
+
function normalizeHashCode(value) {
|
|
94
|
+
if (!Number.isFinite(value)) {
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
return value | 0;
|
|
98
|
+
}
|
|
99
|
+
function normalizeNumberKey(value) {
|
|
100
|
+
if (Number.isNaN(value)) {
|
|
101
|
+
return 'NaN';
|
|
102
|
+
}
|
|
103
|
+
if (value === 0) {
|
|
104
|
+
return '0';
|
|
105
|
+
}
|
|
106
|
+
return String(value);
|
|
107
|
+
}
|
|
108
|
+
function hashString(value) {
|
|
109
|
+
let hash = 0x811c9dc5;
|
|
110
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
111
|
+
hash ^= value.charCodeAt(index);
|
|
112
|
+
hash = Math.imul(hash, 0x01000193);
|
|
113
|
+
}
|
|
114
|
+
return hash | 0;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=hash.js.map
|
package/hash.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["./soundscript/hash.sts"],"names":[],"mappings":"AAaA,MAAM,UAAU,UAAU,CACxB,IAA4B,EAC5B,MAAsC;IAEtC,OAAO;QACL,IAAI,CAAC,KAAK;YACR,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACxC,CAAC;QACD,MAAM;K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GAAG,MAA2B;IAC1D,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa;IACtC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC;IACX,CAAC;IAED,OAAO,KAAK,GAAG,CAAC,CAAC;AACnB,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACvC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,IAAI,IAAI,GAAG,UAAU,CAAC;IACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,IAAI,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,GAAG,CAAC,CAAC;AAClB,CAAC","sourcesContent":["import type { Eq } from '@soundscript/soundscript/compare';\nimport type { Option, Result } from '@soundscript/soundscript/result';\n\nexport type HashCode = number;\n\nexport interface Hash<T> {\n hash(value: T): HashCode;\n}\n\nexport interface HashEq<T> extends Hash<T>, Eq<T> {}\n\ntype HashEqValue<THashEq> = THashEq extends HashEq<infer TValue> ? TValue : never;\n\nexport function fromHashEq<T>(\n hash: (value: T) => HashCode,\n equals: (left: T, right: T) => boolean,\n): HashEq<T> {\n return {\n hash(value) {\n return normalizeHashCode(hash(value));\n },\n equals,\n };\n}\n\nexport function contramap<A, B>(\n hashEq: HashEq<A>,\n project: (value: B) => A,\n): HashEq<B> {\n return fromHashEq(\n (value) => hashEq.hash(project(value)),\n (left, right) => hashEq.equals(project(left), project(right)),\n );\n}\n\nexport function lazyHashEq<T>(getHashEq: () => HashEq<T>): HashEq<T> {\n return fromHashEq(\n (value) => getHashEq().hash(value),\n (left, right) => getHashEq().equals(left, right),\n );\n}\n\nexport function arrayHash<T>(itemHash: HashEq<T>): HashEq<readonly T[]> {\n return fromHashEq(\n (value) => combineHashes(...value.map((entry) => itemHash.hash(entry))),\n (left, right) => {\n if (left.length !== right.length) {\n return false;\n }\n\n for (let index = 0; index < left.length; index += 1) {\n if (!itemHash.equals(left[index]!, right[index]!)) {\n return false;\n }\n }\n\n return true;\n },\n );\n}\n\nexport function tupleHash<const THashEqs extends readonly HashEq<unknown>[]>(\n ...elements: THashEqs\n): HashEq<{ readonly [K in keyof THashEqs]: HashEqValue<THashEqs[K]> }> {\n return fromHashEq(\n (value) => {\n const values = value as readonly unknown[];\n if (values.length !== elements.length) {\n return 0;\n }\n return combineHashes(\n ...elements.map((elementHash, index) => elementHash.hash(values[index])),\n );\n },\n (left, right) => {\n const leftValues = left as readonly unknown[];\n const rightValues = right as readonly unknown[];\n if (leftValues.length !== elements.length || rightValues.length !== elements.length) {\n return false;\n }\n\n for (let index = 0; index < elements.length; index += 1) {\n const elementHash = elements[index];\n if (!elementHash) {\n continue;\n }\n if (!elementHash.equals(leftValues[index], rightValues[index])) {\n return false;\n }\n }\n\n return true;\n },\n );\n}\n\nexport function optionHash<T>(itemHash: HashEq<T>): HashEq<Option<T>> {\n return fromHashEq(\n (value) =>\n value.tag === 'ok'\n ? combineHashes(stringHash.hash('ok'), itemHash.hash(value.value))\n : stringHash.hash('err'),\n (left, right) => {\n if (left.tag !== right.tag) {\n return false;\n }\n\n if (left.tag === 'ok' && right.tag === 'ok') {\n return itemHash.equals(left.value, right.value);\n }\n\n return true;\n },\n );\n}\n\nexport function resultHash<T, E>(okHash: HashEq<T>, errHash: HashEq<E>): HashEq<Result<T, E>> {\n return fromHashEq(\n (value) =>\n value.tag === 'ok'\n ? combineHashes(stringHash.hash('ok'), okHash.hash(value.value))\n : combineHashes(stringHash.hash('err'), errHash.hash(value.error)),\n (left, right) => {\n if (left.tag !== right.tag) {\n return false;\n }\n\n if (left.tag === 'ok' && right.tag === 'ok') {\n return okHash.equals(left.value, right.value);\n }\n\n if (left.tag === 'err' && right.tag === 'err') {\n return errHash.equals(left.error, right.error);\n }\n\n return false;\n },\n );\n}\n\nexport const stringHash: HashEq<string> = fromHashEq(\n hashString,\n (left, right) => left === right,\n);\n\nexport const numberHash: HashEq<number> = fromHashEq(\n (value) => hashString(normalizeNumberKey(value)),\n (left, right) => left === right || (Number.isNaN(left) && Number.isNaN(right)),\n);\n\nexport const booleanHash: HashEq<boolean> = fromHashEq(\n (value) => value ? 1 : 0,\n (left, right) => left === right,\n);\n\nexport const bigintHash: HashEq<bigint> = fromHashEq(\n (value) => hashString(value.toString()),\n (left, right) => left === right,\n);\n\nexport function combineHashes(...hashes: readonly HashCode[]): HashCode {\n let hash = 0;\n for (const value of hashes) {\n hash = Math.imul(hash ^ normalizeHashCode(value), 0x01000193);\n }\n return normalizeHashCode(hash);\n}\n\nfunction normalizeHashCode(value: number): HashCode {\n if (!Number.isFinite(value)) {\n return 0;\n }\n\n return value | 0;\n}\n\nfunction normalizeNumberKey(value: number): string {\n if (Number.isNaN(value)) {\n return 'NaN';\n }\n\n if (value === 0) {\n return '0';\n }\n\n return String(value);\n}\n\nfunction hashString(value: string): HashCode {\n let hash = 0x811c9dc5;\n for (let index = 0; index < value.length; index += 1) {\n hash ^= value.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n return hash | 0;\n}\n"]}
|
package/hkt.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface TypeLambda {
|
|
2
|
+
readonly Args: readonly unknown[];
|
|
3
|
+
readonly type: unknown;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type Apply<F extends TypeLambda, Args extends readonly unknown[]> = F extends {
|
|
7
|
+
readonly __target: infer Target extends TypeLambda;
|
|
8
|
+
readonly __prefix: infer Prefix extends readonly unknown[];
|
|
9
|
+
} ? Apply<Target, [...Prefix, ...Args]>
|
|
10
|
+
: (F & { readonly Args: Args })['type'];
|
|
11
|
+
|
|
12
|
+
export type Bind<F extends TypeLambda, Prefix extends readonly unknown[]> = TypeLambda & {
|
|
13
|
+
readonly __target: F;
|
|
14
|
+
readonly __prefix: Prefix;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type Kind<F extends TypeLambda, A> = Apply<F, [A]>;
|
|
18
|
+
export type Kind2<F extends TypeLambda, A, B> = Apply<F, [A, B]>;
|
|
19
|
+
export type Kind3<F extends TypeLambda, A, B, C> = Apply<F, [A, B, C]>;
|
|
20
|
+
|
|
21
|
+
export type MonadTypeLambda<M extends { readonly __type_lambda?: TypeLambda }> = M extends {
|
|
22
|
+
readonly __type_lambda?: infer F extends TypeLambda;
|
|
23
|
+
} ? F
|
|
24
|
+
: never;
|
|
25
|
+
export type BoundEffect<F extends TypeLambda, A = unknown> = Kind<F, A>;
|
|
26
|
+
export type BoundValue<F extends TypeLambda, Value> = Value extends BoundEffect<F, infer A> ? A
|
|
27
|
+
: never;
|
|
28
|
+
export type Binder<F extends TypeLambda> = <A>(value: BoundEffect<F, A>) => A;
|
|
29
|
+
|
|
30
|
+
export type {
|
|
31
|
+
Applicative,
|
|
32
|
+
AsyncMonad,
|
|
33
|
+
Contravariant,
|
|
34
|
+
Functor,
|
|
35
|
+
Invariant,
|
|
36
|
+
Monad,
|
|
37
|
+
} from '@soundscript/soundscript/typeclasses';
|
|
38
|
+
export { Do, monadGen } from '@soundscript/soundscript/typeclasses';
|
|
39
|
+
|
|
40
|
+
export const hkt: unknown;
|
package/hkt.js
ADDED
package/hkt.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hkt.js","sourceRoot":"","sources":["./soundscript/hkt.sts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAEpE,qFAAqF;AACrF,MAAM,CAAC,MAAM,GAAG,GAAY,SAAS,CAAC","sourcesContent":["export interface TypeLambda {\n readonly Args: readonly unknown[];\n readonly type: unknown;\n}\n\nexport type Apply<F extends TypeLambda, Args extends readonly unknown[]> = F extends {\n readonly __target: infer Target extends TypeLambda;\n readonly __prefix: infer Prefix extends readonly unknown[];\n} ? Apply<Target, [...Prefix, ...Args]>\n : (F & { readonly Args: Args })['type'];\n\nexport type Bind<F extends TypeLambda, Prefix extends readonly unknown[]> = TypeLambda & {\n readonly __target: F;\n readonly __prefix: Prefix;\n};\n\nexport type Kind<F extends TypeLambda, A> = Apply<F, [A]>;\nexport type Kind2<F extends TypeLambda, A, B> = Apply<F, [A, B]>;\nexport type Kind3<F extends TypeLambda, A, B, C> = Apply<F, [A, B, C]>;\n\nexport type MonadTypeLambda<M extends { readonly __type_lambda?: TypeLambda }> = M extends {\n readonly __type_lambda?: infer F extends TypeLambda;\n} ? F\n : never;\nexport type BoundEffect<F extends TypeLambda, A = unknown> = Kind<F, A>;\nexport type BoundValue<F extends TypeLambda, Value> = Value extends BoundEffect<F, infer A> ? A\n : never;\nexport type Binder<F extends TypeLambda> = <A>(value: BoundEffect<F, A>) => A;\n\nexport type {\n Applicative,\n AsyncMonad,\n Contravariant,\n Functor,\n Invariant,\n Monad,\n} from '@soundscript/soundscript/typeclasses';\nexport { Do, monadGen } from '@soundscript/soundscript/typeclasses';\n\n// Macro binding placeholder. The compiler-owned macro pipeline consumes this symbol.\nexport const hkt: unknown = undefined;\n"]}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { Err, None, Ok, Option, Result, Some } from '@soundscript/soundscript/result';
|
|
2
|
+
|
|
3
|
+
export { err, isErr, isNone, isOk, isSome, none, ok, some, Try } from '@soundscript/soundscript/result';
|
|
4
|
+
export { Match, where } from '@soundscript/soundscript/match';
|
|
5
|
+
export { Failure } from '@soundscript/soundscript/failures';
|
|
6
|
+
|
|
7
|
+
export function Defer(cleanup: () => unknown): never;
|
|
8
|
+
export function todo(message?: string): never;
|
|
9
|
+
export function unreachable(message?: string): never;
|
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { err, isErr, isNone, isOk, isSome, none, ok, some, Try } from '@soundscript/soundscript/result';
|
|
2
|
+
export { Match, where } from '@soundscript/soundscript/match';
|
|
3
|
+
export { Failure } from '@soundscript/soundscript/failures';
|
|
4
|
+
function macroRuntimeError(name) {
|
|
5
|
+
throw new Error(`${name}(...) is a Soundscript macro and should be removed during Soundscript expansion.`);
|
|
6
|
+
}
|
|
7
|
+
export function Defer(_cleanup) {
|
|
8
|
+
return macroRuntimeError('Defer');
|
|
9
|
+
}
|
|
10
|
+
export function todo(message) {
|
|
11
|
+
throw new Error(message ? `TODO: ${message}` : 'TODO');
|
|
12
|
+
}
|
|
13
|
+
export function unreachable(message) {
|
|
14
|
+
throw new Error(message ? `Unreachable: ${message}` : 'Unreachable');
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["./soundscript/index.sts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAE5D,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,kFAAkF,CAC1F,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,QAAuB;IAC3C,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,OAAgB;IACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;AACvE,CAAC","sourcesContent":["export type { Err, None, Ok, Option, Result, Some } from '@soundscript/soundscript/result';\n\nexport { err, isErr, isNone, isOk, isSome, none, ok, some, Try } from '@soundscript/soundscript/result';\nexport { Match, where } from '@soundscript/soundscript/match';\nexport { Failure } from '@soundscript/soundscript/failures';\n\nfunction macroRuntimeError(name: string): never {\n throw new Error(\n `${name}(...) is a Soundscript macro and should be removed during Soundscript expansion.`,\n );\n}\n\nexport function Defer(_cleanup: () => unknown): never {\n return macroRuntimeError('Defer');\n}\n\nexport function todo(message?: string): never {\n throw new Error(message ? `TODO: ${message}` : 'TODO');\n}\n\nexport function unreachable(message?: string): never {\n throw new Error(message ? `Unreachable: ${message}` : 'Unreachable');\n}\n"]}
|
package/json.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Failure } from '@soundscript/soundscript/failures';
|
|
2
|
+
import type { Decoder } from '@soundscript/soundscript/decode';
|
|
3
|
+
import type { Encoder } from '@soundscript/soundscript/encode';
|
|
4
|
+
import type { Result } from '@soundscript/soundscript/result';
|
|
5
|
+
|
|
6
|
+
export type JsonArray = JsonValue[];
|
|
7
|
+
export type JsonObject = {
|
|
8
|
+
[key: string]: JsonValue;
|
|
9
|
+
};
|
|
10
|
+
export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
|
|
11
|
+
type LosslessJsonArray = LosslessJsonValue[];
|
|
12
|
+
type LosslessJsonObject = {
|
|
13
|
+
[key: string]: LosslessJsonValue;
|
|
14
|
+
};
|
|
15
|
+
export type LosslessJsonValue =
|
|
16
|
+
| string
|
|
17
|
+
| number
|
|
18
|
+
| bigint
|
|
19
|
+
| boolean
|
|
20
|
+
| null
|
|
21
|
+
| LosslessJsonObject
|
|
22
|
+
| LosslessJsonArray;
|
|
23
|
+
|
|
24
|
+
export type JsonLikeArray = JsonLikeValue[];
|
|
25
|
+
export type JsonLikeObject = {
|
|
26
|
+
[key: string]: JsonLikeValue;
|
|
27
|
+
};
|
|
28
|
+
export type JsonLikeValue =
|
|
29
|
+
| string
|
|
30
|
+
| number
|
|
31
|
+
| boolean
|
|
32
|
+
| bigint
|
|
33
|
+
| null
|
|
34
|
+
| undefined
|
|
35
|
+
| JsonLikeObject
|
|
36
|
+
| JsonLikeArray;
|
|
37
|
+
|
|
38
|
+
export interface JsonParseOptions {
|
|
39
|
+
int64?: 'default' | 'lossless';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type JsonStringifyBigintMode = 'number' | 'reject' | 'string';
|
|
43
|
+
|
|
44
|
+
export interface JsonStringifyOptions {
|
|
45
|
+
int64?: 'default' | 'string' | 'lossless';
|
|
46
|
+
readonly bigint?: JsonStringifyBigintMode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export class JsonParseFailure extends Failure {
|
|
50
|
+
constructor(cause?: unknown);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export class JsonStringifyFailure extends Failure {
|
|
54
|
+
constructor(cause?: unknown);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function parseJson(text: string): Result<JsonValue, JsonParseFailure>;
|
|
58
|
+
export function parseJson(
|
|
59
|
+
text: string,
|
|
60
|
+
options: JsonParseOptions & { int64: 'lossless' },
|
|
61
|
+
): Result<LosslessJsonValue, JsonParseFailure>;
|
|
62
|
+
export function parseJson(
|
|
63
|
+
text: string,
|
|
64
|
+
options?: JsonParseOptions,
|
|
65
|
+
): Result<JsonValue | LosslessJsonValue, JsonParseFailure>;
|
|
66
|
+
export function stringifyJson(value: JsonValue): Result<string, JsonStringifyFailure>;
|
|
67
|
+
export function stringifyJson(
|
|
68
|
+
value: LosslessJsonValue,
|
|
69
|
+
options: JsonStringifyOptions & { int64: 'string' | 'lossless' },
|
|
70
|
+
): Result<string, JsonStringifyFailure>;
|
|
71
|
+
export function stringifyJson(
|
|
72
|
+
value: JsonValue | LosslessJsonValue,
|
|
73
|
+
options?: JsonStringifyOptions,
|
|
74
|
+
): Result<string, JsonStringifyFailure>;
|
|
75
|
+
export function parseAndDecode<T, E>(
|
|
76
|
+
text: string,
|
|
77
|
+
decoder: Decoder<T, E>,
|
|
78
|
+
): Result<T, JsonParseFailure | E>;
|
|
79
|
+
export function encodeAndStringify<T, E>(
|
|
80
|
+
value: T,
|
|
81
|
+
encoder: Encoder<T, JsonValue, E>,
|
|
82
|
+
): Result<string, E | JsonStringifyFailure>;
|
|
83
|
+
export function isJsonValue(value: unknown): value is JsonValue;
|
|
84
|
+
export function parseJsonLike(text: string): Result<JsonLikeValue, JsonParseFailure>;
|
|
85
|
+
export function stringifyJsonLike(
|
|
86
|
+
value: JsonLikeValue,
|
|
87
|
+
options?: JsonStringifyOptions,
|
|
88
|
+
): Result<string, JsonStringifyFailure>;
|
|
89
|
+
export function decodeJson<T, E>(
|
|
90
|
+
text: string,
|
|
91
|
+
decoder: Decoder<T, E>,
|
|
92
|
+
): Result<T, E | JsonParseFailure>;
|
|
93
|
+
export function encodeJson<T, E>(
|
|
94
|
+
value: T,
|
|
95
|
+
encoder: Encoder<T, JsonLikeValue, E>,
|
|
96
|
+
options?: JsonStringifyOptions,
|
|
97
|
+
): Result<string, E | JsonStringifyFailure>;
|
|
98
|
+
export function isJsonLikeValue(value: unknown): value is JsonLikeValue;
|