funkscript 0.0.0-stage → 0.2.4
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 +21 -0
- package/README.md +204 -2
- package/dist/Widget.tsx +9 -0
- package/dist/ast/types.d.ts +513 -0
- package/dist/ast/types.d.ts.map +1 -0
- package/dist/ast/types.js +5 -0
- package/dist/ast/types.js.map +1 -0
- package/dist/ast/walk.d.ts +8 -0
- package/dist/ast/walk.d.ts.map +1 -0
- package/dist/ast/walk.js +23 -0
- package/dist/ast/walk.js.map +1 -0
- package/dist/cli/build-bun.d.ts +24 -0
- package/dist/cli/build-bun.d.ts.map +1 -0
- package/dist/cli/build-bun.js +190 -0
- package/dist/cli/build-bun.js.map +1 -0
- package/dist/cli/build-watch.d.ts +21 -0
- package/dist/cli/build-watch.d.ts.map +1 -0
- package/dist/cli/build-watch.js +244 -0
- package/dist/cli/build-watch.js.map +1 -0
- package/dist/cli/build.d.ts +4 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.js +338 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/check.d.ts +4 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/check.js +278 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/commands.d.ts +13 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +262 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/doc.d.ts +3 -0
- package/dist/cli/doc.d.ts.map +1 -0
- package/dist/cli/doc.js +71 -0
- package/dist/cli/doc.js.map +1 -0
- package/dist/cli/doctor.d.ts +3 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +121 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/emit.d.ts +4 -0
- package/dist/cli/emit.d.ts.map +1 -0
- package/dist/cli/emit.js +87 -0
- package/dist/cli/emit.js.map +1 -0
- package/dist/cli/explain.d.ts +3 -0
- package/dist/cli/explain.d.ts.map +1 -0
- package/dist/cli/explain.js +103 -0
- package/dist/cli/explain.js.map +1 -0
- package/dist/cli/fmt.d.ts +3 -0
- package/dist/cli/fmt.d.ts.map +1 -0
- package/dist/cli/fmt.js +146 -0
- package/dist/cli/fmt.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +186 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +10 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +412 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/io.d.ts +9 -0
- package/dist/cli/io.d.ts.map +1 -0
- package/dist/cli/io.js +113 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/output-collisions.d.ts +2 -0
- package/dist/cli/output-collisions.d.ts.map +1 -0
- package/dist/cli/output-collisions.js +39 -0
- package/dist/cli/output-collisions.js.map +1 -0
- package/dist/cli/pipeline-style.d.ts +3 -0
- package/dist/cli/pipeline-style.d.ts.map +1 -0
- package/dist/cli/pipeline-style.js +45 -0
- package/dist/cli/pipeline-style.js.map +1 -0
- package/dist/cli/repl.d.ts +37 -0
- package/dist/cli/repl.d.ts.map +1 -0
- package/dist/cli/repl.js +334 -0
- package/dist/cli/repl.js.map +1 -0
- package/dist/cli/run.d.ts +4 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +185 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/test.d.ts +3 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +124 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/cli/tsc.d.ts +3 -0
- package/dist/cli/tsc.d.ts.map +1 -0
- package/dist/cli/tsc.js +143 -0
- package/dist/cli/tsc.js.map +1 -0
- package/dist/cli/typecheck.d.ts +23 -0
- package/dist/cli/typecheck.d.ts.map +1 -0
- package/dist/cli/typecheck.js +65 -0
- package/dist/cli/typecheck.js.map +1 -0
- package/dist/compiler/ast-inspection.d.ts +18 -0
- package/dist/compiler/ast-inspection.d.ts.map +1 -0
- package/dist/compiler/ast-inspection.js +96 -0
- package/dist/compiler/ast-inspection.js.map +1 -0
- package/dist/compiler/boolean-operators.d.ts +8 -0
- package/dist/compiler/boolean-operators.d.ts.map +1 -0
- package/dist/compiler/boolean-operators.js +84 -0
- package/dist/compiler/boolean-operators.js.map +1 -0
- package/dist/compiler/check.d.ts +87 -0
- package/dist/compiler/check.d.ts.map +1 -0
- package/dist/compiler/check.js +1830 -0
- package/dist/compiler/check.js.map +1 -0
- package/dist/compiler/diagnostics.d.ts +6 -0
- package/dist/compiler/diagnostics.d.ts.map +1 -0
- package/dist/compiler/diagnostics.js +136 -0
- package/dist/compiler/diagnostics.js.map +1 -0
- package/dist/compiler/effect-mutation-rule.d.ts +4 -0
- package/dist/compiler/effect-mutation-rule.d.ts.map +1 -0
- package/dist/compiler/effect-mutation-rule.js +348 -0
- package/dist/compiler/effect-mutation-rule.js.map +1 -0
- package/dist/compiler/entry-rules.d.ts +5 -0
- package/dist/compiler/entry-rules.d.ts.map +1 -0
- package/dist/compiler/entry-rules.js +89 -0
- package/dist/compiler/entry-rules.js.map +1 -0
- package/dist/compiler/imported-record-functions.d.ts +4 -0
- package/dist/compiler/imported-record-functions.d.ts.map +1 -0
- package/dist/compiler/imported-record-functions.js +706 -0
- package/dist/compiler/imported-record-functions.js.map +1 -0
- package/dist/compiler/imported-schemas.d.ts +21 -0
- package/dist/compiler/imported-schemas.d.ts.map +1 -0
- package/dist/compiler/imported-schemas.js +461 -0
- package/dist/compiler/imported-schemas.js.map +1 -0
- package/dist/compiler/incremental-build.d.ts +23 -0
- package/dist/compiler/incremental-build.d.ts.map +1 -0
- package/dist/compiler/incremental-build.js +90 -0
- package/dist/compiler/incremental-build.js.map +1 -0
- package/dist/compiler/incremental-dependencies.d.ts +7 -0
- package/dist/compiler/incremental-dependencies.d.ts.map +1 -0
- package/dist/compiler/incremental-dependencies.js +190 -0
- package/dist/compiler/incremental-dependencies.js.map +1 -0
- package/dist/compiler/js-interop-nullability.d.ts +9 -0
- package/dist/compiler/js-interop-nullability.d.ts.map +1 -0
- package/dist/compiler/js-interop-nullability.js +57 -0
- package/dist/compiler/js-interop-nullability.js.map +1 -0
- package/dist/compiler/module-resolution.d.ts +6 -0
- package/dist/compiler/module-resolution.d.ts.map +1 -0
- package/dist/compiler/module-resolution.js +44 -0
- package/dist/compiler/module-resolution.js.map +1 -0
- package/dist/compiler/modules/output-collisions.d.ts +2 -0
- package/dist/compiler/modules/output-collisions.d.ts.map +1 -0
- package/dist/compiler/modules/output-collisions.js +39 -0
- package/dist/compiler/modules/output-collisions.js.map +1 -0
- package/dist/compiler/modules/output-plan.d.ts +7 -0
- package/dist/compiler/modules/output-plan.d.ts.map +1 -0
- package/dist/compiler/modules/output-plan.js +37 -0
- package/dist/compiler/modules/output-plan.js.map +1 -0
- package/dist/compiler/modules/resolution.d.ts +8 -0
- package/dist/compiler/modules/resolution.d.ts.map +1 -0
- package/dist/compiler/modules/resolution.js +48 -0
- package/dist/compiler/modules/resolution.js.map +1 -0
- package/dist/compiler/numeric-comparisons.d.ts +9 -0
- package/dist/compiler/numeric-comparisons.d.ts.map +1 -0
- package/dist/compiler/numeric-comparisons.js +153 -0
- package/dist/compiler/numeric-comparisons.js.map +1 -0
- package/dist/compiler/optional-arguments.d.ts +11 -0
- package/dist/compiler/optional-arguments.d.ts.map +1 -0
- package/dist/compiler/optional-arguments.js +246 -0
- package/dist/compiler/optional-arguments.js.map +1 -0
- package/dist/compiler/package-fingerprint.d.ts +7 -0
- package/dist/compiler/package-fingerprint.d.ts.map +1 -0
- package/dist/compiler/package-fingerprint.js +178 -0
- package/dist/compiler/package-fingerprint.js.map +1 -0
- package/dist/compiler/package-record-contracts.d.ts +5 -0
- package/dist/compiler/package-record-contracts.d.ts.map +1 -0
- package/dist/compiler/package-record-contracts.js +126 -0
- package/dist/compiler/package-record-contracts.js.map +1 -0
- package/dist/compiler/pipeline-companions.d.ts +18 -0
- package/dist/compiler/pipeline-companions.d.ts.map +1 -0
- package/dist/compiler/pipeline-companions.js +1042 -0
- package/dist/compiler/pipeline-companions.js.map +1 -0
- package/dist/compiler/pipelines/catalog.d.ts +15 -0
- package/dist/compiler/pipelines/catalog.d.ts.map +1 -0
- package/dist/compiler/pipelines/catalog.js +55 -0
- package/dist/compiler/pipelines/catalog.js.map +1 -0
- package/dist/compiler/pipelines/companions.d.ts +18 -0
- package/dist/compiler/pipelines/companions.d.ts.map +1 -0
- package/dist/compiler/pipelines/companions.js +1042 -0
- package/dist/compiler/pipelines/companions.js.map +1 -0
- package/dist/compiler/pipelines/resolution.d.ts +38 -0
- package/dist/compiler/pipelines/resolution.d.ts.map +1 -0
- package/dist/compiler/pipelines/resolution.js +571 -0
- package/dist/compiler/pipelines/resolution.js.map +1 -0
- package/dist/compiler/project-config.d.ts +28 -0
- package/dist/compiler/project-config.d.ts.map +1 -0
- package/dist/compiler/project-config.js +155 -0
- package/dist/compiler/project-config.js.map +1 -0
- package/dist/compiler/providers.d.ts +4 -0
- package/dist/compiler/providers.d.ts.map +1 -0
- package/dist/compiler/providers.js +101 -0
- package/dist/compiler/providers.js.map +1 -0
- package/dist/compiler/record-contracts.d.ts +6 -0
- package/dist/compiler/record-contracts.d.ts.map +1 -0
- package/dist/compiler/record-contracts.js +41 -0
- package/dist/compiler/record-contracts.js.map +1 -0
- package/dist/compiler/rules/control-flow.d.ts +10 -0
- package/dist/compiler/rules/control-flow.d.ts.map +1 -0
- package/dist/compiler/rules/control-flow.js +19 -0
- package/dist/compiler/rules/control-flow.js.map +1 -0
- package/dist/compiler/rules/diagnostic.d.ts +4 -0
- package/dist/compiler/rules/diagnostic.d.ts.map +1 -0
- package/dist/compiler/rules/diagnostic.js +2 -0
- package/dist/compiler/rules/diagnostic.js.map +1 -0
- package/dist/compiler/rules/module-scope-refs.d.ts +5 -0
- package/dist/compiler/rules/module-scope-refs.d.ts.map +1 -0
- package/dist/compiler/rules/module-scope-refs.js +47 -0
- package/dist/compiler/rules/module-scope-refs.js.map +1 -0
- package/dist/compiler/schemas/analysis.d.ts +13 -0
- package/dist/compiler/schemas/analysis.d.ts.map +1 -0
- package/dist/compiler/schemas/analysis.js +24 -0
- package/dist/compiler/schemas/analysis.js.map +1 -0
- package/dist/compiler/schemas/imported-record-functions.d.ts +4 -0
- package/dist/compiler/schemas/imported-record-functions.d.ts.map +1 -0
- package/dist/compiler/schemas/imported-record-functions.js +706 -0
- package/dist/compiler/schemas/imported-record-functions.js.map +1 -0
- package/dist/compiler/schemas/imported-schemas.d.ts +21 -0
- package/dist/compiler/schemas/imported-schemas.d.ts.map +1 -0
- package/dist/compiler/schemas/imported-schemas.js +461 -0
- package/dist/compiler/schemas/imported-schemas.js.map +1 -0
- package/dist/compiler/source-map.d.ts +6 -0
- package/dist/compiler/source-map.d.ts.map +1 -0
- package/dist/compiler/source-map.js +127 -0
- package/dist/compiler/source-map.js.map +1 -0
- package/dist/compiler/typescript-context.d.ts +33 -0
- package/dist/compiler/typescript-context.d.ts.map +1 -0
- package/dist/compiler/typescript-context.js +200 -0
- package/dist/compiler/typescript-context.js.map +1 -0
- package/dist/compiler.d.ts +77 -0
- package/dist/compiler.d.ts.map +1 -0
- package/dist/compiler.js +497 -0
- package/dist/compiler.js.map +1 -0
- package/dist/emitter/assemblyscript.d.ts +5 -0
- package/dist/emitter/assemblyscript.d.ts.map +1 -0
- package/dist/emitter/assemblyscript.js +979 -0
- package/dist/emitter/assemblyscript.js.map +1 -0
- package/dist/emitter/declarations.d.ts +46 -0
- package/dist/emitter/declarations.d.ts.map +1 -0
- package/dist/emitter/declarations.js +739 -0
- package/dist/emitter/declarations.js.map +1 -0
- package/dist/emitter/emitter.d.ts +165 -0
- package/dist/emitter/emitter.d.ts.map +1 -0
- package/dist/emitter/emitter.js +2448 -0
- package/dist/emitter/emitter.js.map +1 -0
- package/dist/emitter/imports.d.ts +6 -0
- package/dist/emitter/imports.d.ts.map +1 -0
- package/dist/emitter/imports.js +73 -0
- package/dist/emitter/imports.js.map +1 -0
- package/dist/emitter/indent.d.ts +3 -0
- package/dist/emitter/indent.d.ts.map +1 -0
- package/dist/emitter/indent.js +31 -0
- package/dist/emitter/indent.js.map +1 -0
- package/dist/emitter/jsx.d.ts +20 -0
- package/dist/emitter/jsx.d.ts.map +1 -0
- package/dist/emitter/jsx.js +82 -0
- package/dist/emitter/jsx.js.map +1 -0
- package/dist/emitter/local-bindings.d.ts +6 -0
- package/dist/emitter/local-bindings.d.ts.map +1 -0
- package/dist/emitter/local-bindings.js +32 -0
- package/dist/emitter/local-bindings.js.map +1 -0
- package/dist/emitter/match.d.ts +56 -0
- package/dist/emitter/match.d.ts.map +1 -0
- package/dist/emitter/match.js +1287 -0
- package/dist/emitter/match.js.map +1 -0
- package/dist/emitter/pipeline-catalog.d.ts +15 -0
- package/dist/emitter/pipeline-catalog.d.ts.map +1 -0
- package/dist/emitter/pipeline-catalog.js +55 -0
- package/dist/emitter/pipeline-catalog.js.map +1 -0
- package/dist/emitter/pipeline-resolution.d.ts +38 -0
- package/dist/emitter/pipeline-resolution.d.ts.map +1 -0
- package/dist/emitter/pipeline-resolution.js +571 -0
- package/dist/emitter/pipeline-resolution.js.map +1 -0
- package/dist/emitter/runtime-helpers.d.ts +10 -0
- package/dist/emitter/runtime-helpers.d.ts.map +1 -0
- package/dist/emitter/runtime-helpers.js +22 -0
- package/dist/emitter/runtime-helpers.js.map +1 -0
- package/dist/emitter/schemas.d.ts +36 -0
- package/dist/emitter/schemas.d.ts.map +1 -0
- package/dist/emitter/schemas.js +766 -0
- package/dist/emitter/schemas.js.map +1 -0
- package/dist/emitter/statements.d.ts +23 -0
- package/dist/emitter/statements.d.ts.map +1 -0
- package/dist/emitter/statements.js +216 -0
- package/dist/emitter/statements.js.map +1 -0
- package/dist/emitter/tagged-match.d.ts +23 -0
- package/dist/emitter/tagged-match.d.ts.map +1 -0
- package/dist/emitter/tagged-match.js +109 -0
- package/dist/emitter/tagged-match.js.map +1 -0
- package/dist/emitter/types.d.ts +22 -0
- package/dist/emitter/types.d.ts.map +1 -0
- package/dist/emitter/types.js +231 -0
- package/dist/emitter/types.js.map +1 -0
- package/dist/errors.d.ts +39 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +98 -0
- package/dist/errors.js.map +1 -0
- package/dist/formatter/comments.d.ts +25 -0
- package/dist/formatter/comments.d.ts.map +1 -0
- package/dist/formatter/comments.js +283 -0
- package/dist/formatter/comments.js.map +1 -0
- package/dist/formatter/index.d.ts +71 -0
- package/dist/formatter/index.d.ts.map +1 -0
- package/dist/formatter/index.js +1113 -0
- package/dist/formatter/index.js.map +1 -0
- package/dist/formatter/operator-precedence.d.ts +3 -0
- package/dist/formatter/operator-precedence.d.ts.map +1 -0
- package/dist/formatter/operator-precedence.js +27 -0
- package/dist/formatter/operator-precedence.js.map +1 -0
- package/dist/formatter/prettier.d.ts +7 -0
- package/dist/formatter/prettier.d.ts.map +1 -0
- package/dist/formatter/prettier.js +51 -0
- package/dist/formatter/prettier.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/interop/callback.d.ts +38 -0
- package/dist/interop/callback.d.ts.map +1 -0
- package/dist/interop/callback.js +130 -0
- package/dist/interop/callback.js.map +1 -0
- package/dist/interop/index.d.ts +6 -0
- package/dist/interop/index.d.ts.map +1 -0
- package/dist/interop/index.js +6 -0
- package/dist/interop/index.js.map +1 -0
- package/dist/interop/js.d.ts +16 -0
- package/dist/interop/js.d.ts.map +1 -0
- package/dist/interop/js.js +35 -0
- package/dist/interop/js.js.map +1 -0
- package/dist/interop/record.d.ts +9 -0
- package/dist/interop/record.d.ts.map +1 -0
- package/dist/interop/record.js +18 -0
- package/dist/interop/record.js.map +1 -0
- package/dist/interop/valibot.d.ts +9 -0
- package/dist/interop/valibot.d.ts.map +1 -0
- package/dist/interop/valibot.js +94 -0
- package/dist/interop/valibot.js.map +1 -0
- package/dist/interop/zod.d.ts +45 -0
- package/dist/interop/zod.d.ts.map +1 -0
- package/dist/interop/zod.js +143 -0
- package/dist/interop/zod.js.map +1 -0
- package/dist/lexer/lexer.d.ts +65 -0
- package/dist/lexer/lexer.d.ts.map +1 -0
- package/dist/lexer/lexer.js +1335 -0
- package/dist/lexer/lexer.js.map +1 -0
- package/dist/lexer/tokens.d.ts +96 -0
- package/dist/lexer/tokens.d.ts.map +1 -0
- package/dist/lexer/tokens.js +150 -0
- package/dist/lexer/tokens.js.map +1 -0
- package/dist/lsp/code-action-worker.d.ts +2 -0
- package/dist/lsp/code-action-worker.d.ts.map +1 -0
- package/dist/lsp/code-action-worker.js +17 -0
- package/dist/lsp/code-action-worker.js.map +1 -0
- package/dist/lsp/completion.d.ts +11 -0
- package/dist/lsp/completion.d.ts.map +1 -0
- package/dist/lsp/completion.js +260 -0
- package/dist/lsp/completion.js.map +1 -0
- package/dist/lsp/definition.d.ts +42 -0
- package/dist/lsp/definition.d.ts.map +1 -0
- package/dist/lsp/definition.js +1074 -0
- package/dist/lsp/definition.js.map +1 -0
- package/dist/lsp/diagnostics-worker.d.ts +2 -0
- package/dist/lsp/diagnostics-worker.d.ts.map +1 -0
- package/dist/lsp/diagnostics-worker.js +169 -0
- package/dist/lsp/diagnostics-worker.js.map +1 -0
- package/dist/lsp/docs.d.ts +37 -0
- package/dist/lsp/docs.d.ts.map +1 -0
- package/dist/lsp/docs.js +830 -0
- package/dist/lsp/docs.js.map +1 -0
- package/dist/lsp/error-channel.d.ts +3 -0
- package/dist/lsp/error-channel.d.ts.map +1 -0
- package/dist/lsp/error-channel.js +48 -0
- package/dist/lsp/error-channel.js.map +1 -0
- package/dist/lsp/hover.d.ts +5 -0
- package/dist/lsp/hover.d.ts.map +1 -0
- package/dist/lsp/hover.js +651 -0
- package/dist/lsp/hover.js.map +1 -0
- package/dist/lsp/imports.d.ts +5 -0
- package/dist/lsp/imports.d.ts.map +1 -0
- package/dist/lsp/imports.js +317 -0
- package/dist/lsp/imports.js.map +1 -0
- package/dist/lsp/index.d.ts +16 -0
- package/dist/lsp/index.d.ts.map +1 -0
- package/dist/lsp/index.js +17 -0
- package/dist/lsp/index.js.map +1 -0
- package/dist/lsp/inlay-hints.d.ts +3 -0
- package/dist/lsp/inlay-hints.d.ts.map +1 -0
- package/dist/lsp/inlay-hints.js +236 -0
- package/dist/lsp/inlay-hints.js.map +1 -0
- package/dist/lsp/interop-rename.d.ts +26 -0
- package/dist/lsp/interop-rename.d.ts.map +1 -0
- package/dist/lsp/interop-rename.js +346 -0
- package/dist/lsp/interop-rename.js.map +1 -0
- package/dist/lsp/match-arms.d.ts +3 -0
- package/dist/lsp/match-arms.d.ts.map +1 -0
- package/dist/lsp/match-arms.js +341 -0
- package/dist/lsp/match-arms.js.map +1 -0
- package/dist/lsp/navigation.d.ts +23 -0
- package/dist/lsp/navigation.d.ts.map +1 -0
- package/dist/lsp/navigation.js +430 -0
- package/dist/lsp/navigation.js.map +1 -0
- package/dist/lsp/parsed-documents.d.ts +25 -0
- package/dist/lsp/parsed-documents.d.ts.map +1 -0
- package/dist/lsp/parsed-documents.js +47 -0
- package/dist/lsp/parsed-documents.js.map +1 -0
- package/dist/lsp/rename-worker.d.ts +2 -0
- package/dist/lsp/rename-worker.d.ts.map +1 -0
- package/dist/lsp/rename-worker.js +27 -0
- package/dist/lsp/rename-worker.js.map +1 -0
- package/dist/lsp/server.d.ts +78 -0
- package/dist/lsp/server.d.ts.map +1 -0
- package/dist/lsp/server.js +1098 -0
- package/dist/lsp/server.js.map +1 -0
- package/dist/lsp/thunk-pipeline.d.ts +4 -0
- package/dist/lsp/thunk-pipeline.d.ts.map +1 -0
- package/dist/lsp/thunk-pipeline.js +95 -0
- package/dist/lsp/thunk-pipeline.js.map +1 -0
- package/dist/lsp/validation.d.ts +8 -0
- package/dist/lsp/validation.d.ts.map +1 -0
- package/dist/lsp/validation.js +124 -0
- package/dist/lsp/validation.js.map +1 -0
- package/dist/lsp/workspace.d.ts +8 -0
- package/dist/lsp/workspace.d.ts.map +1 -0
- package/dist/lsp/workspace.js +70 -0
- package/dist/lsp/workspace.js.map +1 -0
- package/dist/math.ts +1 -0
- package/dist/parser/declarations.d.ts +21 -0
- package/dist/parser/declarations.d.ts.map +1 -0
- package/dist/parser/declarations.js +626 -0
- package/dist/parser/declarations.js.map +1 -0
- package/dist/parser/errors.d.ts +9 -0
- package/dist/parser/errors.d.ts.map +1 -0
- package/dist/parser/errors.js +11 -0
- package/dist/parser/errors.js.map +1 -0
- package/dist/parser/index.d.ts +9 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +9 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/jsx.d.ts +5 -0
- package/dist/parser/jsx.d.ts.map +1 -0
- package/dist/parser/jsx.js +188 -0
- package/dist/parser/jsx.js.map +1 -0
- package/dist/parser/operator-expressions.d.ts +16 -0
- package/dist/parser/operator-expressions.d.ts.map +1 -0
- package/dist/parser/operator-expressions.js +146 -0
- package/dist/parser/operator-expressions.js.map +1 -0
- package/dist/parser/parser.d.ts +104 -0
- package/dist/parser/parser.d.ts.map +1 -0
- package/dist/parser/parser.js +1216 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/patterns.d.ts +9 -0
- package/dist/parser/patterns.d.ts.map +1 -0
- package/dist/parser/patterns.js +292 -0
- package/dist/parser/patterns.js.map +1 -0
- package/dist/parser/pipeline-expressions.d.ts +10 -0
- package/dist/parser/pipeline-expressions.d.ts.map +1 -0
- package/dist/parser/pipeline-expressions.js +57 -0
- package/dist/parser/pipeline-expressions.js.map +1 -0
- package/dist/parser/scope.d.ts +17 -0
- package/dist/parser/scope.d.ts.map +1 -0
- package/dist/parser/scope.js +56 -0
- package/dist/parser/scope.js.map +1 -0
- package/dist/parser/statements.d.ts +13 -0
- package/dist/parser/statements.d.ts.map +1 -0
- package/dist/parser/statements.js +737 -0
- package/dist/parser/statements.js.map +1 -0
- package/dist/parser/types.d.ts +13 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js +371 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/plugins/bun-preload.d.ts +4 -0
- package/dist/plugins/bun-preload.d.ts.map +1 -0
- package/dist/plugins/bun-preload.js +18 -0
- package/dist/plugins/bun-preload.js.map +1 -0
- package/dist/plugins/bun.d.ts +115 -0
- package/dist/plugins/bun.d.ts.map +1 -0
- package/dist/plugins/bun.js +240 -0
- package/dist/plugins/bun.js.map +1 -0
- package/dist/plugins/esbuild.d.ts +45 -0
- package/dist/plugins/esbuild.d.ts.map +1 -0
- package/dist/plugins/esbuild.js +184 -0
- package/dist/plugins/esbuild.js.map +1 -0
- package/dist/plugins/type-view.d.ts +30 -0
- package/dist/plugins/type-view.d.ts.map +1 -0
- package/dist/plugins/type-view.js +245 -0
- package/dist/plugins/type-view.js.map +1 -0
- package/dist/plugins/vite.d.ts +56 -0
- package/dist/plugins/vite.d.ts.map +1 -0
- package/dist/plugins/vite.js +182 -0
- package/dist/plugins/vite.js.map +1 -0
- package/dist/service.ts +3 -0
- package/dist/service.ts.map +1 -0
- package/dist/testing/index.d.ts +24 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +56 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tooling/doc.d.ts +82 -0
- package/dist/tooling/doc.d.ts.map +1 -0
- package/dist/tooling/doc.js +624 -0
- package/dist/tooling/doc.js.map +1 -0
- package/dist/tooling/idiomatic.d.ts +20 -0
- package/dist/tooling/idiomatic.d.ts.map +1 -0
- package/dist/tooling/idiomatic.js +154 -0
- package/dist/tooling/idiomatic.js.map +1 -0
- package/dist/tooling/migrate.d.ts +62 -0
- package/dist/tooling/migrate.d.ts.map +1 -0
- package/dist/tooling/migrate.js +608 -0
- package/dist/tooling/migrate.js.map +1 -0
- package/dist/tooling/pipeline-style.d.ts +12 -0
- package/dist/tooling/pipeline-style.d.ts.map +1 -0
- package/dist/tooling/pipeline-style.js +208 -0
- package/dist/tooling/pipeline-style.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +25 -0
- package/dist/version.js.map +1 -0
- package/package.json +128 -4
- package/src/ast/types.ts +753 -0
- package/src/ast/walk.ts +35 -0
- package/src/cli/build-bun.ts +249 -0
- package/src/cli/build-watch.ts +299 -0
- package/src/cli/build.ts +450 -0
- package/src/cli/check.ts +342 -0
- package/src/cli/commands.ts +301 -0
- package/src/cli/doc.ts +81 -0
- package/src/cli/doctor.ts +173 -0
- package/src/cli/emit.ts +138 -0
- package/src/cli/explain.ts +127 -0
- package/src/cli/fmt.ts +170 -0
- package/src/cli/index.ts +227 -0
- package/src/cli/init.ts +491 -0
- package/src/cli/io.ts +150 -0
- package/src/cli/pipeline-style.ts +55 -0
- package/src/cli/repl.ts +443 -0
- package/src/cli/run.ts +238 -0
- package/src/cli/test.ts +148 -0
- package/src/cli/tsc.ts +207 -0
- package/src/cli/typecheck.ts +100 -0
- package/src/compiler/ast-inspection.ts +121 -0
- package/src/compiler/boolean-operators.ts +108 -0
- package/src/compiler/check.ts +2763 -0
- package/src/compiler/diagnostics.ts +179 -0
- package/src/compiler/effect-mutation-rule.ts +407 -0
- package/src/compiler/entry-rules.ts +116 -0
- package/src/compiler/incremental-build.ts +131 -0
- package/src/compiler/incremental-dependencies.ts +200 -0
- package/src/compiler/js-interop-nullability.ts +67 -0
- package/src/compiler/modules/output-collisions.ts +48 -0
- package/src/compiler/modules/output-plan.ts +46 -0
- package/src/compiler/modules/resolution.ts +56 -0
- package/src/compiler/numeric-comparisons.ts +213 -0
- package/src/compiler/optional-arguments.ts +335 -0
- package/src/compiler/package-fingerprint.ts +216 -0
- package/src/compiler/package-record-contracts.ts +156 -0
- package/src/compiler/pipelines/catalog.ts +1128 -0
- package/src/compiler/pipelines/companions.ts +1279 -0
- package/src/compiler/pipelines/resolution.ts +684 -0
- package/src/compiler/project-config.ts +221 -0
- package/src/compiler/record-contracts.ts +46 -0
- package/src/compiler/rules/control-flow.ts +57 -0
- package/src/compiler/rules/diagnostic.ts +11 -0
- package/src/compiler/rules/module-scope-refs.ts +63 -0
- package/src/compiler/schemas/analysis.ts +45 -0
- package/src/compiler/schemas/imported-record-functions.ts +984 -0
- package/src/compiler/schemas/imported-schemas.ts +761 -0
- package/src/compiler/source-map.ts +165 -0
- package/src/compiler/typescript-context.ts +250 -0
- package/src/compiler.ts +865 -0
- package/src/emitter/assemblyscript.ts +1220 -0
- package/src/emitter/declarations.ts +916 -0
- package/src/emitter/emitter.ts +3128 -0
- package/src/emitter/imports.ts +89 -0
- package/src/emitter/indent.ts +39 -0
- package/src/emitter/jsx.ts +122 -0
- package/src/emitter/local-bindings.ts +40 -0
- package/src/emitter/match.ts +1631 -0
- package/src/emitter/runtime-helpers.ts +31 -0
- package/src/emitter/schemas.ts +969 -0
- package/src/emitter/statements.ts +310 -0
- package/src/emitter/tagged-match.ts +171 -0
- package/src/emitter/types.ts +289 -0
- package/src/errors.ts +115 -0
- package/src/formatter/comments.ts +350 -0
- package/src/formatter/index.ts +1457 -0
- package/src/formatter/operator-precedence.ts +36 -0
- package/src/formatter/prettier.ts +61 -0
- package/src/index.ts +16 -0
- package/src/interop/callback.ts +188 -0
- package/src/interop/js.ts +66 -0
- package/src/interop/record.ts +36 -0
- package/src/interop/valibot.ts +141 -0
- package/src/interop/zod.ts +219 -0
- package/src/lexer/lexer.ts +1521 -0
- package/src/lexer/tokens.ts +174 -0
- package/src/lsp/code-action-worker.ts +31 -0
- package/src/lsp/completion.ts +343 -0
- package/src/lsp/definition.ts +1165 -0
- package/src/lsp/diagnostics-worker.ts +198 -0
- package/src/lsp/docs.ts +864 -0
- package/src/lsp/error-channel.ts +63 -0
- package/src/lsp/hover.ts +803 -0
- package/src/lsp/imports.ts +380 -0
- package/src/lsp/index.ts +55 -0
- package/src/lsp/inlay-hints.ts +308 -0
- package/src/lsp/interop-rename.ts +454 -0
- package/src/lsp/match-arms.ts +400 -0
- package/src/lsp/navigation.ts +553 -0
- package/src/lsp/parsed-documents.ts +64 -0
- package/src/lsp/rename-worker.ts +40 -0
- package/src/lsp/server.ts +1437 -0
- package/src/lsp/thunk-pipeline.ts +117 -0
- package/src/lsp/validation.ts +147 -0
- package/src/lsp/workspace.ts +74 -0
- package/src/parser/declarations.ts +808 -0
- package/src/parser/errors.ts +18 -0
- package/src/parser/jsx.ts +253 -0
- package/src/parser/operator-expressions.ts +170 -0
- package/src/parser/parser.ts +1565 -0
- package/src/parser/patterns.ts +342 -0
- package/src/parser/pipeline-expressions.ts +77 -0
- package/src/parser/scope.ts +69 -0
- package/src/parser/statements.ts +831 -0
- package/src/parser/types.ts +453 -0
- package/src/plugins/bun-preload.ts +25 -0
- package/src/plugins/bun.ts +448 -0
- package/src/plugins/esbuild.ts +308 -0
- package/src/plugins/type-view.ts +326 -0
- package/src/plugins/vite.ts +294 -0
- package/src/testing/index.ts +72 -0
- package/src/tooling/doc.ts +786 -0
- package/src/tooling/idiomatic.ts +202 -0
- package/src/tooling/pipeline-style.ts +248 -0
- package/src/version.ts +27 -0
package/dist/lsp/docs.js
ADDED
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FunkScript Language Documentation Catalog & Markdown Hover Generator
|
|
3
|
+
*/
|
|
4
|
+
/** Shared language catalogue used by LSP hover and generated reference docs. */
|
|
5
|
+
export const DOC_MAP = {
|
|
6
|
+
service: [
|
|
7
|
+
"keyword",
|
|
8
|
+
"service ServiceName\n methodName: (param: Type) => Effect<Success, Error>",
|
|
9
|
+
"Declares a dependency-injected service interface.",
|
|
10
|
+
"Defines a service contract that compiles to an Effect `Context.Service` tag.\n\nCalls to service methods (such as `UserRepo.find(id)`) inside `effect` blocks automatically resolve the service from Context and track its dependency in the Effect `R` channel. Implementations are supplied at runtime via `Layer.succeed`, `Layer.effect`, or `Layer.scoped`.",
|
|
11
|
+
'export service UserRepo\n find: (id: String) => Effect<User, NotFound>\n save: (user: User) => Effect<Void>\n\nexport UserRepoLive =\n Layer.succeed(UserRepo, {\n find: (id) => Effect.succeed({ id, name: "Ada" }),\n save: (user) => Effect.void,\n })',
|
|
12
|
+
["Layer", "Context", "effect", "Effect", "js"],
|
|
13
|
+
],
|
|
14
|
+
record: [
|
|
15
|
+
"keyword",
|
|
16
|
+
"schema Name = { field: Type }\n# or expression:\n{ key: value, ...spread, path.nested: value }",
|
|
17
|
+
"Declares an immutable record schema or constructs an immutable record.",
|
|
18
|
+
'FunkScript records are deeply immutable by default.\n\nRecord updates support shallow spread (`{ ...user, age: 37 }`) and deep nested dot-path updates (`{ ...order, shipping.carrier: "DHL" }`). Deep updates compile to Mutative\'s structural-sharing `create(...)` to guarantee both performance and purity without manual nested spreads.',
|
|
19
|
+
"export schema User = {\n id: String\n name: String\n address: { city: String, zip: String }\n}\n\nupdateCity = (user: User, newCity: String) =>\n { ...user, address.city: newCity }",
|
|
20
|
+
["schema", "mut", "variant"],
|
|
21
|
+
],
|
|
22
|
+
variant: [
|
|
23
|
+
"keyword",
|
|
24
|
+
"schema TypeName =\n | VariantA(param: Type)\n | VariantB",
|
|
25
|
+
"Declares a tagged union variant constructor within a schema.",
|
|
26
|
+
"Declares a variant case of a discriminated union algebraic data type.\n\nUnder the hood, variants compile to Effect `Data.TaggedEnum` and `Schema.Union`. Each variant can be instantiated directly as a constructor function (e.g. `Circle(10)`) or constant (`None`) and pattern-matched exhaustively with `match`.",
|
|
27
|
+
"export schema Shape =\n | Circle(radius: Number)\n | Rect(width: Number, height: Number)\n\narea = (s: Shape) =>\n match s\n | Circle(r) => Math.PI * r * r\n | Rect(w, h) => w * h",
|
|
28
|
+
["schema", "match", "error"],
|
|
29
|
+
],
|
|
30
|
+
effect: [
|
|
31
|
+
"keyword",
|
|
32
|
+
"effect {\n result <- effectfulCall\n _ <- logCall\n => result\n}",
|
|
33
|
+
"Introduces an effectful computation block with generator semantics.",
|
|
34
|
+
"Delimits an Effect workflow that compiles to `Effect.gen(function* () { ... })`. Named effect bindings are automatically wrapped in `Effect.fn(name)` for tracing. Bind effects with `<-`, discard results with `_ <-`, and finish with `=> value`. Early exits and errors use typed Effect operations; unhandled error-channel mismatches are reported as FS_UNHANDLED_ERROR.",
|
|
35
|
+
'getUserProfile = (id: String) => effect {\n user <- UserRepo.find(id)\n _ <- Console.log("Found: " + user.name)\n => user.name\n}',
|
|
36
|
+
["Effect", "service", "fail", "<-"],
|
|
37
|
+
],
|
|
38
|
+
match: [
|
|
39
|
+
"keyword",
|
|
40
|
+
"match value\n | Pattern1 => result1\n | Pattern2 when guard => result2\n | _ => fallback",
|
|
41
|
+
"Unified pattern matching and conditional branching construct.",
|
|
42
|
+
"`match` is the sole branching construct in FunkScript, replacing `if`, `else`, and `switch`.\n\nFeatures:\n- Exhaustive structural pattern matching on tagged variants, literals, records, and arrays (via `ts-pattern`).\n- Compile-time exhaustiveness checking when the wildcard `_` arm is omitted.\n- Subjectless boolean branching (`match | condition => expr | _ => default`).\n- Pattern guards via `when` and or-patterns via `| A | B =>`.",
|
|
43
|
+
'describe = (shape: Shape) =>\n match shape\n | Circle(r) when r <= 0 => "Degenerate circle"\n | Circle(r) => "Circle with radius " + r\n | Rect(w, h) => "Rectangle of " + w + "x" + h',
|
|
44
|
+
["variant", "when", "schema"],
|
|
45
|
+
],
|
|
46
|
+
catch: [
|
|
47
|
+
"keyword",
|
|
48
|
+
"catch effectValue\n | ErrorTag(cause) => recoveryEffect\n# or in pipeline:\neffectValue |> catch\n | TagA(_) | TagB(_) => fallbackEffect",
|
|
49
|
+
"Recover selected tagged Effect failures standalone or in a pipeline.",
|
|
50
|
+
"Handles typed failures by tag (including `|` or-patterns of tags). The optional binding (or `_`) is the whole error; unmatched failures propagate. Each arm returns an Effect. Defects and interruptions are not caught.",
|
|
51
|
+
"catch loadUser(id)\n | NotFound(cause) => Effect.succeed(anonymous(cause.id))\n | Timeout(_) | Offline(_) => Effect.succeed(guest)",
|
|
52
|
+
["effect", "error", "match"],
|
|
53
|
+
],
|
|
54
|
+
mut: [
|
|
55
|
+
"keyword",
|
|
56
|
+
"mut draft = initialValue\n# or in pipeline:\nvalue |> mut (draft) => draft.field = newValue",
|
|
57
|
+
"Declares a local mutable draft or mutable variable.",
|
|
58
|
+
"FunkScript bindings and data structures are immutable by default. The `mut` keyword enables explicit, controlled copy-on-write mutation backed by Mutative's `create(...)`.\n\nRules:\n- Local reassignments are only permitted on `mut` bindings.\n- Pipeline drafts (`|> mut (draft) => ...`) create isolated draft scopes.\n- Top-level `mut` and closure-captured mutable mutation across fibers are prohibited.",
|
|
59
|
+
"addItems = (list: Array<String>, item: String) =>\n list |> mut (draft) =>\n draft.push(item)",
|
|
60
|
+
["record", "|>"],
|
|
61
|
+
],
|
|
62
|
+
fail: [
|
|
63
|
+
"keyword",
|
|
64
|
+
"Effect.fail(error: E): Effect<Never, E, Never>\n# in effect block:\n_ <- Effect.fail(ErrorType(reason))",
|
|
65
|
+
"Constructs an Effect that fails with a recoverable typed error.",
|
|
66
|
+
"FunkScript eliminates unchecked exceptions, `throw`, and `try/catch`. All recoverable failures are modeled as typed values in the Effect `E` channel.\n\n`fail` (or `Effect.fail`) produces an Effect that terminates execution along the error channel. Callers must handle the typed error exhaustively using `match`, `Effect.catchTag`, or `Effect.catch`.",
|
|
67
|
+
"findAccount = (id: String) =>\n match db.lookup(id)\n | Some(acc) => Effect.succeed(acc)\n | None => Effect.fail(AccountNotFound(id))",
|
|
68
|
+
["effect", "error", "Effect.succeed", "Effect.catchTag"],
|
|
69
|
+
["Effect.fail"],
|
|
70
|
+
],
|
|
71
|
+
schema: [
|
|
72
|
+
"keyword",
|
|
73
|
+
"schema Name = { field: Type, optional: Option<Type> }\n# or tagged union:\nschema Name = | CaseA | CaseB(v: Type)",
|
|
74
|
+
"Unified declaration for record shapes, tagged unions, refinements, and type signatures.",
|
|
75
|
+
"Declares data models backed by Effect Schema and `Data.TaggedEnum`.\n\nData schema fields declared with `Option<T>` decode missing, null, or undefined input to a real Effect `Option`; encoding `None` omits the field. Decoding is explicit. `SchemaInput<Name>` describes the encoded JavaScript input type without decoding it. A generic data record produces a schema factory: pass one runtime schema per type parameter. A record containing a function or Effect type is instead a compile-time contract with no runtime decoder.",
|
|
76
|
+
"export schema Order = {\n id: String\n note: Option<String>\n}\n\nparseOrder = (raw: Unknown) =>\n => raw |> decode(Order)",
|
|
77
|
+
["record", "variant", "error", "SchemaInput"],
|
|
78
|
+
],
|
|
79
|
+
error: [
|
|
80
|
+
"keyword",
|
|
81
|
+
"error ErrorName(field: Type, ...)",
|
|
82
|
+
"Declares a typed error schema backed by Schema.TaggedError.",
|
|
83
|
+
"Defines a domain error with a discriminator `_tag` matching the error name.\n\nBecause errors are typed values rather than unchecked runtime exceptions, they appear explicitly in the `E` channel of `Effect<A, E, R>` and can be matched by tag.",
|
|
84
|
+
"export error NotFound(id: string)\nexport error Unauthorized(reason: string)\n\nlookup = (id: string) =>\n Effect.fail(NotFound(id))",
|
|
85
|
+
["fail", "schema", "Effect.catchTag"],
|
|
86
|
+
],
|
|
87
|
+
import: [
|
|
88
|
+
"keyword",
|
|
89
|
+
'import { Name } from "module"',
|
|
90
|
+
"Imports bindings, services, types, or schemas from another module.",
|
|
91
|
+
"Static ESM imports support named, default, namespace, side-effect-only, and type-only forms. Module specifiers must be non-interpolated strings.",
|
|
92
|
+
'import { Effect, Console, pipe } from "effect"',
|
|
93
|
+
["export", "from"],
|
|
94
|
+
],
|
|
95
|
+
export: [
|
|
96
|
+
"keyword",
|
|
97
|
+
"export declaration = ...\nexport schema Name = ...\nexport service Name ...\nexport default <expression>",
|
|
98
|
+
"Exports a binding, schema, error, service, or default value from the module.",
|
|
99
|
+
"Exposes module members to other files. Supports both named exports (`export name = value`) and default exports (`export default expr`).",
|
|
100
|
+
'export greet = (name: string) => "Hello, " + name\nexport schema User = { id: string, name: string }\nexport default App',
|
|
101
|
+
["import", "default"],
|
|
102
|
+
],
|
|
103
|
+
default: [
|
|
104
|
+
"keyword",
|
|
105
|
+
"export default <expression>",
|
|
106
|
+
"Exports an expression as the default export of the module.",
|
|
107
|
+
"Specifies the default export of a module or route file.\n\nOnly one default export is permitted per file. Useful for framework integrations (e.g. Next.js, Remix, Vite) and route components.",
|
|
108
|
+
"export default () => <div />",
|
|
109
|
+
["export", "import"],
|
|
110
|
+
],
|
|
111
|
+
when: [
|
|
112
|
+
"keyword",
|
|
113
|
+
"| Pattern when condition => result",
|
|
114
|
+
"Pattern match guard condition within a match arm.",
|
|
115
|
+
"Adds a boolean predicate to a `match` arm. The arm matches only if both the structural pattern matches and the `when` condition evaluates to `true`.",
|
|
116
|
+
'categorizeAge = (age: number) =>\n match age\n | a when a < 13 => "child"\n | a when a < 20 => "teen"\n | _ => "adult"',
|
|
117
|
+
["match"],
|
|
118
|
+
],
|
|
119
|
+
and: [
|
|
120
|
+
"keyword",
|
|
121
|
+
"expr1 and expr2",
|
|
122
|
+
"Logical short-circuit conjunction operator (&&).",
|
|
123
|
+
"Evaluates to `true` if both `Boolean` operands are `true`. Short-circuits if the left operand is `false`. FunkScript requires `Boolean` operands for `and` and uses the English word `and` instead of `&&`.",
|
|
124
|
+
"isValid = (n: Number) => n >= 0 and n <= 100",
|
|
125
|
+
["or", "not"],
|
|
126
|
+
],
|
|
127
|
+
or: [
|
|
128
|
+
"keyword",
|
|
129
|
+
"expr1 or expr2",
|
|
130
|
+
"Logical short-circuit disjunction operator (||).",
|
|
131
|
+
"Evaluates to `true` if either `Boolean` operand is `true`. Short-circuits if the left operand is `true`. FunkScript requires `Boolean` operands for `or` and uses the English word `or` instead of `||`.",
|
|
132
|
+
"canProceed = (user: User) =>\n user.isAdmin or user.isOwner",
|
|
133
|
+
["and", "not"],
|
|
134
|
+
],
|
|
135
|
+
not: [
|
|
136
|
+
"keyword",
|
|
137
|
+
"not expression",
|
|
138
|
+
"Logical negation operator (!).",
|
|
139
|
+
"Inverts a `Boolean` expression. Evaluates to `true` if the expression is `false`, and `false` otherwise. FunkScript uses `not` instead of `!`.",
|
|
140
|
+
"isEmpty = (list: Array<String>) => not (list.length > 0)",
|
|
141
|
+
["and", "or"],
|
|
142
|
+
],
|
|
143
|
+
par: [
|
|
144
|
+
"keyword",
|
|
145
|
+
"par (concurrency?) {\n a <- taskA\n b <- taskB\n => { a, b }\n}",
|
|
146
|
+
"Executes tasks in parallel using structured fork-join concurrency.",
|
|
147
|
+
"Delimits a structured concurrency block that runs all bound tasks in parallel. Defaults to `concurrency: 'inherit'`, allowing it to automatically participate in outer concurrency pools. Compiles to `Effect.all(..., { concurrency })`.",
|
|
148
|
+
"export fetchBoth = (id: String) => par {\n user <- fetchUser(id)\n orders <- fetchOrders(id)\n}",
|
|
149
|
+
["effect", "Effect.all"],
|
|
150
|
+
],
|
|
151
|
+
"<": [
|
|
152
|
+
"operator",
|
|
153
|
+
"number < number",
|
|
154
|
+
"Numeric less-than comparison.",
|
|
155
|
+
"Native ordering operators are available only when both operands are proven numbers. Compare strings and domain values with an explicit Effect Order.",
|
|
156
|
+
"isBefore = start < end",
|
|
157
|
+
["Order.isLessThan", "String.Order"],
|
|
158
|
+
],
|
|
159
|
+
"<=": [
|
|
160
|
+
"operator",
|
|
161
|
+
"number <= number",
|
|
162
|
+
"Numeric less-than-or-equal comparison.",
|
|
163
|
+
"Native ordering operators are available only when both operands are proven numbers. Compare strings and domain values with an explicit Effect Order.",
|
|
164
|
+
"isWithinLimit = count <= limit",
|
|
165
|
+
["Order.isLessThanOrEqualTo", "String.Order"],
|
|
166
|
+
],
|
|
167
|
+
">": [
|
|
168
|
+
"operator",
|
|
169
|
+
"number > number",
|
|
170
|
+
"Numeric greater-than comparison.",
|
|
171
|
+
"Native ordering operators are available only when both operands are proven numbers. Compare strings and domain values with an explicit Effect Order.",
|
|
172
|
+
"isPositive = balance > 0",
|
|
173
|
+
["Order.isGreaterThan", "String.Order"],
|
|
174
|
+
],
|
|
175
|
+
">=": [
|
|
176
|
+
"operator",
|
|
177
|
+
"number >= number",
|
|
178
|
+
"Numeric greater-than-or-equal comparison.",
|
|
179
|
+
"Native ordering operators are available only when both operands are proven numbers. Compare strings and domain values with an explicit Effect Order.",
|
|
180
|
+
"isEligible = age >= 18",
|
|
181
|
+
["Order.isGreaterThanOrEqualTo", "String.Order"],
|
|
182
|
+
],
|
|
183
|
+
lessThan: [
|
|
184
|
+
"operator",
|
|
185
|
+
"value |> lessThan(target)\n# or direct call:\nlessThan(value, target)",
|
|
186
|
+
"Typed less-than comparison resolved from static operand type.",
|
|
187
|
+
"Resolves unqualified comparison against the static type of the operand, lowering to matching Effect APIs such as `Number.isLessThan` or `DateTime.isLessThan`.",
|
|
188
|
+
"isPast = score |> lessThan(deadline)\nisDirect = lessThan(score, deadline)",
|
|
189
|
+
["lessThanOrEqualTo", "greaterThan", "greaterThanOrEqualTo", "between"],
|
|
190
|
+
],
|
|
191
|
+
lessThanOrEqualTo: [
|
|
192
|
+
"operator",
|
|
193
|
+
"value |> lessThanOrEqualTo(target)\n# or direct call:\nlessThanOrEqualTo(value, target)",
|
|
194
|
+
"Typed less-than-or-equal comparison resolved from static operand type.",
|
|
195
|
+
"Resolves unqualified comparison against the static type of the operand, lowering to matching Effect APIs such as `Number.isLessThanOrEqualTo` or `DateTime.isLessThanOrEqualTo`.",
|
|
196
|
+
"isOk = score |> lessThanOrEqualTo(maxScore)",
|
|
197
|
+
["lessThan", "greaterThan", "greaterThanOrEqualTo", "between"],
|
|
198
|
+
],
|
|
199
|
+
greaterThan: [
|
|
200
|
+
"operator",
|
|
201
|
+
"value |> greaterThan(target)\n# or direct call:\ngreaterThan(value, target)",
|
|
202
|
+
"Typed greater-than-or-equal comparison resolved from static operand type.",
|
|
203
|
+
"Resolves unqualified comparison against the static type of the operand, lowering to matching Effect APIs such as `Number.isGreaterThan` or `DateTime.isGreaterThan`.",
|
|
204
|
+
"isAbove = score |> greaterThan(minScore)",
|
|
205
|
+
["lessThan", "lessThanOrEqualTo", "greaterThanOrEqualTo", "between"],
|
|
206
|
+
],
|
|
207
|
+
greaterThanOrEqualTo: [
|
|
208
|
+
"operator",
|
|
209
|
+
"value |> greaterThanOrEqualTo(target)\n# or direct call:\ngreaterThanOrEqualTo(value, target)",
|
|
210
|
+
"Typed greater-than-or-equal comparison resolved from static operand type.",
|
|
211
|
+
"Resolves unqualified comparison against the static type of the operand, lowering to matching Effect APIs such as `Number.isGreaterThanOrEqualTo` or `DateTime.isGreaterThanOrEqualTo`.",
|
|
212
|
+
"isPassed = score |> greaterThanOrEqualTo(passingScore)",
|
|
213
|
+
["lessThan", "lessThanOrEqualTo", "greaterThan", "between"],
|
|
214
|
+
],
|
|
215
|
+
between: [
|
|
216
|
+
"operator",
|
|
217
|
+
"value |> between(min, max)\n# or direct call:\nbetween(value, min, max)",
|
|
218
|
+
"Typed range comparison resolved from static operand type.",
|
|
219
|
+
"Resolves unqualified between comparison against the static type of the operand, lowering to matching Effect APIs such as `Number.between` or `DateTime.between`.",
|
|
220
|
+
"inRange = score |> between(1, 100)",
|
|
221
|
+
["lessThan", "greaterThan"],
|
|
222
|
+
],
|
|
223
|
+
true: [
|
|
224
|
+
"keyword",
|
|
225
|
+
"true: boolean",
|
|
226
|
+
"Boolean literal representing truth.",
|
|
227
|
+
"The primitive boolean value representing true.",
|
|
228
|
+
"isEnabled: boolean = true",
|
|
229
|
+
["false", "boolean"],
|
|
230
|
+
],
|
|
231
|
+
false: [
|
|
232
|
+
"keyword",
|
|
233
|
+
"false: boolean",
|
|
234
|
+
"Boolean literal representing falsehood.",
|
|
235
|
+
"The primitive boolean value representing false.",
|
|
236
|
+
"isDone: boolean = false",
|
|
237
|
+
["true", "boolean"],
|
|
238
|
+
],
|
|
239
|
+
from: [
|
|
240
|
+
"keyword",
|
|
241
|
+
'import { X } from "module"',
|
|
242
|
+
"Specifies the module source in import and export declarations.",
|
|
243
|
+
"Specifies the source file path or npm package name for `import` and `export { ... } from` statements.",
|
|
244
|
+
'import { Effect } from "effect"',
|
|
245
|
+
["import", "export"],
|
|
246
|
+
],
|
|
247
|
+
js: [
|
|
248
|
+
"keyword",
|
|
249
|
+
"res <- js promiseFn()\nexport js handler = (...) => ...\neff |> runPromise",
|
|
250
|
+
"JavaScript and npm interop keyword for typed async interop.",
|
|
251
|
+
"Lifts JavaScript calls and Promises into Effects inside effect blocks (`res <- js promiseFn()`). Native throws and rejections become the typed `JsInteropError` channel. Declared nullable values become `Option<A>`; non-nullable values remain `A`. An `any`, `unknown`, or unresolved result becomes `Unknown`, preserving nullish values for schema validation. Exported JS functions return Promises (`export js handler`), as does `eff |> runPromise`.",
|
|
252
|
+
"fetchData = (url: String) => effect {\n res <- js fetch(url)\n result <- js res.json()\n => result\n}",
|
|
253
|
+
["ts", "effect", "export"],
|
|
254
|
+
],
|
|
255
|
+
as: [
|
|
256
|
+
"keyword",
|
|
257
|
+
"as {\n export function name(args...): Type { ... }\n}",
|
|
258
|
+
"Declares an embedded WebAssembly kernel compiled with AssemblyScript.",
|
|
259
|
+
"Embeds high-performance numeric WebAssembly routines directly in FunkScript using AssemblyScript.\n\nFeatures:\n- Automatic zero-cost TypeScript wrapper generation with validation.\n- Dual execution modes: synchronous `fn(...)` and Effect-wrapped `fn.effect(...)`.\n- Zero-copy pointer-level chaining via `fn.raw(...)` returning `WasmHandle`.\n- Automatic Wasm memory lifecycle management via `fn.scoped(...)` with Effect `Scope`.\n- Tuples: native multi-value return `[A, B]` desugared into zero-cost records.\n- 128-bit SIMD intrinsics (`v128`, `f64x2`, `f32x4`, `i32x4`) enabled out of the box.",
|
|
260
|
+
"as {\n export function square(value: f64): f64 {\n return value * value;\n }\n}\n\nexport squareNumber = (value: Number) => square(value)",
|
|
261
|
+
["effect", "js", "ts"],
|
|
262
|
+
],
|
|
263
|
+
ts: [
|
|
264
|
+
"keyword",
|
|
265
|
+
"schema Dict = ts { Record<string, unknown> }\nschema Position = ts { import('vscode-languageserver').Position }",
|
|
266
|
+
"TypeScript escape hatch for complex declarations, expressions, and types.",
|
|
267
|
+
"Embeds verbatim TypeScript in a balanced `ts { ... }` block without expanding FunkScript's core grammar. Useful for generics, utility types, and third-party library types.",
|
|
268
|
+
"schema Options = {\n metadata: ts { Record<string, unknown> }\n}",
|
|
269
|
+
["js", "schema"],
|
|
270
|
+
],
|
|
271
|
+
String: [
|
|
272
|
+
"primitive",
|
|
273
|
+
"type String",
|
|
274
|
+
"UTF-16 text string primitive type.",
|
|
275
|
+
'Represents immutable textual data. FunkScript strings support string interpolation via curly brace syntax `"{status}: {message}"` and multiline string literals.',
|
|
276
|
+
'greeting: String = "Hello, FunkScript!"',
|
|
277
|
+
["NonEmptyString", "Number", "Boolean"],
|
|
278
|
+
],
|
|
279
|
+
Number: [
|
|
280
|
+
"primitive",
|
|
281
|
+
"type Number",
|
|
282
|
+
"Double-precision IEEE 754 floating point and integer numeric primitive.",
|
|
283
|
+
"Represents all numbers in FunkScript, including floating-point values and integers. Can be refined to integers via `Int` schema.",
|
|
284
|
+
"count: Number = 42\nratio: Number = 3.14159",
|
|
285
|
+
["Int", "String", "Boolean"],
|
|
286
|
+
],
|
|
287
|
+
Boolean: [
|
|
288
|
+
"primitive",
|
|
289
|
+
"type Boolean = true | false",
|
|
290
|
+
"Primitive boolean logic type.",
|
|
291
|
+
"Represents logical truth values (`true` or `false`).",
|
|
292
|
+
"ready: Boolean = true",
|
|
293
|
+
["true", "false", "and", "or", "not"],
|
|
294
|
+
],
|
|
295
|
+
Void: [
|
|
296
|
+
"primitive",
|
|
297
|
+
"type Void",
|
|
298
|
+
"Void type and value representing the absence of meaningful data.",
|
|
299
|
+
"Used as the canonical void type and discard return value in FunkScript (e.g. '=> Void' or 'Effect<Void>'). Compiles cleanly to TypeScript void.",
|
|
300
|
+
"logInfo = (msg: String): Effect<Void> => effect {\n _ <- Console.log(msg)\n => Void\n}",
|
|
301
|
+
["Unknown", "Never", "effect"],
|
|
302
|
+
],
|
|
303
|
+
Unknown: [
|
|
304
|
+
"primitive",
|
|
305
|
+
"type Unknown",
|
|
306
|
+
"The type-safe counterpart of any; represents an uninspected value.",
|
|
307
|
+
"Top type representing values whose type is not statically known (e.g. from external API payloads). Must be narrowed via `raw |> decode(TargetSchema)` or `match` before access.",
|
|
308
|
+
"parsePayload = (raw: Unknown) =>\n => raw |> decode(User)",
|
|
309
|
+
["Never", "schema"],
|
|
310
|
+
],
|
|
311
|
+
Never: [
|
|
312
|
+
"primitive",
|
|
313
|
+
"type Never",
|
|
314
|
+
"The bottom type representing values that never occur.",
|
|
315
|
+
"Uninhabited type used for functions that never return, effects that cannot fail (`Effect<A, Never>`), or unreachable branches in exhaustive pattern matching.",
|
|
316
|
+
"unreachable = (x: Never): Never => x",
|
|
317
|
+
["Unknown", "Void"],
|
|
318
|
+
],
|
|
319
|
+
Array: [
|
|
320
|
+
"primitive",
|
|
321
|
+
"type Array<T>",
|
|
322
|
+
"Ordered sequence of elements of type T.",
|
|
323
|
+
"Standard sequence collection. In FunkScript, Arrays are deeply immutable unless operated on inside an explicit `mut` draft. Compatible with Effect's `Array` module combinators (`Array.map`, `Array.filter`).",
|
|
324
|
+
"numbers: Array<Number> = [1, 2, 3, 4, 5]",
|
|
325
|
+
["Chunk", "Record", "mut"],
|
|
326
|
+
],
|
|
327
|
+
Record: [
|
|
328
|
+
"primitive",
|
|
329
|
+
"type Record<K extends string | number | symbol, V>",
|
|
330
|
+
"Dictionary map of keys to values.",
|
|
331
|
+
"Key-value dictionary mapping string keys to values of type `V`.",
|
|
332
|
+
"scores: Record<string, number> = { alice: 100, bob: 95 }",
|
|
333
|
+
["HashMap", "record", "Array"],
|
|
334
|
+
],
|
|
335
|
+
SchemaInput: [
|
|
336
|
+
"primitive",
|
|
337
|
+
"SchemaInput<SchemaName>",
|
|
338
|
+
"The encoded input type of a named runtime schema.",
|
|
339
|
+
"Describes values before schema decoding. Defaulted schema fields can be omitted in this type; defaults and validation only run when the schema is explicitly decoded.",
|
|
340
|
+
'schema Props = { name: String = "guest" }\nexport show = (props: SchemaInput<Props>) => props',
|
|
341
|
+
["schema", "Option"],
|
|
342
|
+
],
|
|
343
|
+
JSNullish: [
|
|
344
|
+
"primitive",
|
|
345
|
+
"type JSNullish<A> = A | null | undefined",
|
|
346
|
+
"A raw JavaScript value that can be null or undefined.",
|
|
347
|
+
"Use at JavaScript boundaries where null and undefined must remain distinct. Matching uses Success(value), Failure(Null), and Failure(Undefined); generated JavaScript retains its raw representation. It is not an Effect Result and does not validate input.",
|
|
348
|
+
'show = (value: JSNullish<String>) =>\n match value\n | Success(text) => text\n | Failure(Null) => "null"\n | Failure(Undefined) => "undefined"',
|
|
349
|
+
["Option", "Result"],
|
|
350
|
+
],
|
|
351
|
+
Option: [
|
|
352
|
+
"primitive",
|
|
353
|
+
"type Option<A> = Some<A> | None",
|
|
354
|
+
"Data type modeling the presence or absence of a value.",
|
|
355
|
+
"Domain absence can be represented with Effect `Option<A>`, containing `Some(value)` or `None`. At JavaScript boundaries, `JSOptional<A>` and `JSNullish<A>` represent raw nullish values; convert explicitly when an Option is needed.",
|
|
356
|
+
'findUser = (id: string): Option<User> =>\n match id\n | "1" => Option.some({ id: "1", name: "Ada" })\n | _ => Option.none()',
|
|
357
|
+
["Some", "None", "Result"],
|
|
358
|
+
],
|
|
359
|
+
Some: [
|
|
360
|
+
"primitive",
|
|
361
|
+
"Option.some<A>(value: A): Option<A>",
|
|
362
|
+
"Constructs an Option containing a defined value.",
|
|
363
|
+
"Represents the presence of a value in an `Option` container.",
|
|
364
|
+
'hasName = Option.some("Ada")',
|
|
365
|
+
["Option", "None"],
|
|
366
|
+
],
|
|
367
|
+
None: [
|
|
368
|
+
"primitive",
|
|
369
|
+
"Option.none(): Option<never>",
|
|
370
|
+
"Represents the absence of a value in an Option.",
|
|
371
|
+
"Represents an empty `Option` container, replacing `null` and `undefined`.",
|
|
372
|
+
"emptyVal = Option.none()",
|
|
373
|
+
["Option", "Some"],
|
|
374
|
+
],
|
|
375
|
+
Result: [
|
|
376
|
+
"primitive",
|
|
377
|
+
"type Result<A, E> = Success<A, E> | Failure<A, E>",
|
|
378
|
+
"A value representing either success or failure.",
|
|
379
|
+
"Use `Result.succeed(value)` and `Result.fail(error)` when success and failure must remain available as data.",
|
|
380
|
+
'divide = (a: Number, b: Number): Result<Number, String> =>\n match\n | b == 0 => Result.fail("Division by zero")\n | _ => Result.succeed(a / b)',
|
|
381
|
+
["Option", "Effect"],
|
|
382
|
+
],
|
|
383
|
+
Ref: [
|
|
384
|
+
"primitive",
|
|
385
|
+
"type Ref<A>",
|
|
386
|
+
"Fiber-safe concurrent mutable reference cell.",
|
|
387
|
+
"Effect's primitive for shared, concurrent state across fibers. All read and write operations (`Ref.get`, `Ref.set`, `Ref.update`) return Effects, ensuring atomic and lock-free thread safety.",
|
|
388
|
+
"counterRef <- Ref.make(0)\n_ <- Ref.update(counterRef, (n) => n + 1)\ncurrent <- Ref.get(counterRef)",
|
|
389
|
+
["effect", "Effect"],
|
|
390
|
+
],
|
|
391
|
+
Duration: [
|
|
392
|
+
"primitive",
|
|
393
|
+
"type Duration",
|
|
394
|
+
"Representation of an elapsed time interval.",
|
|
395
|
+
"Effect's type representing a time duration, constructed with `Duration.millis`, `Duration.seconds`, `Duration.minutes`, etc. Used for timeouts, delays, and scheduling.",
|
|
396
|
+
"waitFiveSec = Effect.sleep(Duration.seconds(5))",
|
|
397
|
+
["Schedule", "DateTime"],
|
|
398
|
+
],
|
|
399
|
+
DateTime: [
|
|
400
|
+
"primitive",
|
|
401
|
+
"type DateTime",
|
|
402
|
+
"Immutable representation of an absolute point in time.",
|
|
403
|
+
"Effect's modern date-time module replacing JavaScript's mutable `Date`.",
|
|
404
|
+
"now <- DateTime.now",
|
|
405
|
+
["Duration"],
|
|
406
|
+
],
|
|
407
|
+
Int: [
|
|
408
|
+
"primitive",
|
|
409
|
+
"schema Int = number |> Schema.int()",
|
|
410
|
+
"Refinement schema constraining numbers to 32-bit integers.",
|
|
411
|
+
"A refined numeric schema that validates numbers to be whole integers without fractional parts.",
|
|
412
|
+
"schema Age = Int |> Schema.between(0, 120)",
|
|
413
|
+
["number", "schema"],
|
|
414
|
+
],
|
|
415
|
+
Brand: [
|
|
416
|
+
"schema",
|
|
417
|
+
'schema TypeName = BaseType |> Brand("BrandName")',
|
|
418
|
+
"Nominal brand declaration using Effect Brand and Schema.brand.",
|
|
419
|
+
'Attaches a nominal brand to a schema for type-safe distinct identifiers without runtime overhead. Emits `Schema.brand("BrandName")` and TypeScript type `Brand.Brand<"BrandName">`.',
|
|
420
|
+
'schema UserId = String |> Brand("UserId")\nschema PositiveInt = Int |> Brand("Positive")',
|
|
421
|
+
["schema", "Int", "String"],
|
|
422
|
+
],
|
|
423
|
+
UUID: [
|
|
424
|
+
"primitive",
|
|
425
|
+
"schema UUID = string |> Schema.UUID",
|
|
426
|
+
"Refinement schema validating RFC 4122 compliant UUID strings.",
|
|
427
|
+
"Validates and types canonical UUID strings (such as `123e4567-e89b-12d3-a456-426614174000`).",
|
|
428
|
+
'userId: UUID = UUID("550e8400-e29b-41d4-a716-446655440000")',
|
|
429
|
+
["string", "schema"],
|
|
430
|
+
],
|
|
431
|
+
NonEmptyString: [
|
|
432
|
+
"primitive",
|
|
433
|
+
"schema NonEmptyString = string |> Schema.nonEmptyString()",
|
|
434
|
+
"Refinement schema validating strings with length greater than zero.",
|
|
435
|
+
"Guarantees at compile and run time that a string contains at least one character.",
|
|
436
|
+
"schema Username = NonEmptyString",
|
|
437
|
+
["string", "schema"],
|
|
438
|
+
],
|
|
439
|
+
Chunk: [
|
|
440
|
+
"primitive",
|
|
441
|
+
"type Chunk<A>",
|
|
442
|
+
"High-performance, immutable indexed sequence from Effect.",
|
|
443
|
+
"A fast, persistent sequential data structure with O(1) prepend, append, and slice operations, optimized for streaming and batch processing.",
|
|
444
|
+
"items = Chunk.make(1, 2, 3)",
|
|
445
|
+
["Array"],
|
|
446
|
+
],
|
|
447
|
+
HashMap: [
|
|
448
|
+
"primitive",
|
|
449
|
+
"type HashMap<K, V>",
|
|
450
|
+
"Persistent immutable hash map data structure from Effect.",
|
|
451
|
+
"Efficient immutable hash map with structural hashing and equality.",
|
|
452
|
+
'map = HashMap.make(["key", 42])',
|
|
453
|
+
["Record", "HashSet"],
|
|
454
|
+
],
|
|
455
|
+
HashSet: [
|
|
456
|
+
"primitive",
|
|
457
|
+
"type HashSet<A>",
|
|
458
|
+
"Persistent immutable set data structure from Effect.",
|
|
459
|
+
"Efficient immutable collection of unique elements with structural hashing and equality.",
|
|
460
|
+
"set = HashSet.make(1, 2, 3)",
|
|
461
|
+
["HashMap"],
|
|
462
|
+
],
|
|
463
|
+
Effect: [
|
|
464
|
+
"effect",
|
|
465
|
+
"type Effect<Success, Error = never, Requirements = never>",
|
|
466
|
+
"Core Effect type representing a lazy, concurrent computation.",
|
|
467
|
+
"The foundational abstraction in FunkScript.\n\nAn `Effect<A, E, R>` represents a blueprint for a workflow that:\n- Requires an environment/context `R`\n- May fail with a typed error `E`\n- May succeed with a value `A`\n\nEffects are lazy, composable, cancellable, and fibers-based.",
|
|
468
|
+
"type UserFlow = Effect<User, NotFound, UserRepo>",
|
|
469
|
+
["service", "effect", "Layer", "Context"],
|
|
470
|
+
],
|
|
471
|
+
"Effect.succeed": [
|
|
472
|
+
"effect",
|
|
473
|
+
"Effect.succeed<A>(value: A): Effect<A>",
|
|
474
|
+
"Creates an Effect that succeeds immediately with the provided value.",
|
|
475
|
+
"Wraps a pure value in an Effect that succeeds synchronously without errors or dependencies.",
|
|
476
|
+
"pureValue = Effect.succeed(42)",
|
|
477
|
+
["Effect.fail", "Effect.sync"],
|
|
478
|
+
["succeed"],
|
|
479
|
+
],
|
|
480
|
+
"Effect.sync": [
|
|
481
|
+
"effect",
|
|
482
|
+
"Effect.sync<A>(evaluate: () => A): Effect<A>",
|
|
483
|
+
"Wraps a lazy, synchronous side effect into an Effect.",
|
|
484
|
+
"Defers execution of a synchronous function until the Effect is run, capturing any uncaught throws as defects.",
|
|
485
|
+
"randomNum = Effect.sync(=> Math.random())",
|
|
486
|
+
["Effect.succeed", "Effect.tryPromise"],
|
|
487
|
+
["sync"],
|
|
488
|
+
],
|
|
489
|
+
"Effect.tryPromise": [
|
|
490
|
+
"effect",
|
|
491
|
+
"Effect.tryPromise<A, E>(options: { try: () => Promise<A>, catch: (err: unknown) => E }): Effect<A, E>",
|
|
492
|
+
"Bridges an asynchronous Promise-based API into a typed Effect.",
|
|
493
|
+
"Safely converts external Promise calls into FunkScript Effects. Catches Promise rejections and maps them into typed domain errors in the `E` channel.",
|
|
494
|
+
"fetchData = (url: string) =>\n Effect.tryPromise({\n try: () => fetch(url),\n catch: (err) => NetworkError(String(err)),\n })",
|
|
495
|
+
["Effect", "effect"],
|
|
496
|
+
],
|
|
497
|
+
"Effect.map": [
|
|
498
|
+
"effect",
|
|
499
|
+
"Effect.map<A, B>(self: Effect<A, E, R>, f: (a: A) => B): Effect<B, E, R>",
|
|
500
|
+
"Transforms the success value of an Effect using a pure function.",
|
|
501
|
+
"Applies the mapping function `f` to the successful result of `self` without altering errors or dependencies.",
|
|
502
|
+
'lengthEffect =\n Effect.succeed("hello")\n |> Effect.map((s) => s.length)',
|
|
503
|
+
["Effect.flatMap", "Effect.andThen"],
|
|
504
|
+
["map"],
|
|
505
|
+
],
|
|
506
|
+
"Effect.flatMap": [
|
|
507
|
+
"effect",
|
|
508
|
+
"Effect.flatMap<A, B, E2, R2>(self: Effect<A, E, R>, f: (a: A) => Effect<B, E2, R2>): Effect<B, E | E2, R | R2>",
|
|
509
|
+
"Chains another Effectful computation onto the success of this Effect.",
|
|
510
|
+
"Sequentially composes two Effectful actions where the second depends on the result of the first.",
|
|
511
|
+
"step =\n UserRepo.find(id)\n |> Effect.flatMap((user) => EmailService.sendWelcome(user))",
|
|
512
|
+
["Effect.map", "Effect.andThen"],
|
|
513
|
+
["flatMap"],
|
|
514
|
+
],
|
|
515
|
+
"Effect.andThen": [
|
|
516
|
+
"effect",
|
|
517
|
+
"Effect.andThen<A, B>(self: Effect<A, E, R>, next: Effect<B, E2, R2> | ((a: A) => B)): Effect<...>",
|
|
518
|
+
"Sequentially composes effects or functions.",
|
|
519
|
+
"Versatile combinator that chains an Effect or a pure function after another Effect succeeds.",
|
|
520
|
+
"action =\n Effect.succeed(10)\n |> Effect.andThen((n) => n * 2)",
|
|
521
|
+
["Effect.map", "Effect.flatMap"],
|
|
522
|
+
["andThen"],
|
|
523
|
+
],
|
|
524
|
+
"Effect.catch": [
|
|
525
|
+
"effect",
|
|
526
|
+
"Effect.catch<A, E, R, B, E2, R2>(self: Effect<A, E, R>, handler: (err: E) => Effect<B, E2, R2>): Effect<A | B, E2, R | R2>",
|
|
527
|
+
"Recovers from any error in the Effect's error channel.",
|
|
528
|
+
"Catches all typed errors in `E` and invokes a recovery function that returns an alternative Effect.",
|
|
529
|
+
"safeQuery =\n riskyQuery\n |> Effect.catch((err) => Effect.succeed(defaultFallback))",
|
|
530
|
+
["Effect.catchTag", "fail"],
|
|
531
|
+
["catch"],
|
|
532
|
+
],
|
|
533
|
+
"Effect.catchTag": [
|
|
534
|
+
"effect",
|
|
535
|
+
"Effect.catchTag(tag: string, handler: (err: Tagged) => Effect<...>): Effect<...>",
|
|
536
|
+
"Recovers from a specific tagged error matching _tag.",
|
|
537
|
+
"Selectively catches errors matching a specific discriminant tag (from `error` schemas). Leaves all other errors intact in the `E` channel.",
|
|
538
|
+
'workflow =\n UserRepo.find(id)\n |> Effect.catchTag("NotFound", (_err) => Effect.succeed(guestUser))',
|
|
539
|
+
["error", "Effect.catch"],
|
|
540
|
+
["catchTag"],
|
|
541
|
+
],
|
|
542
|
+
"Effect.all": [
|
|
543
|
+
"effect",
|
|
544
|
+
"Effect.all(effects: Array<Effect<...>>, options: { concurrency: Option<Number> }): Effect<Array<...>>",
|
|
545
|
+
"Executes multiple Effects concurrently or sequentially and combines results.",
|
|
546
|
+
"Gathers multiple effects into a single Effect that collects all success values in an array or struct.",
|
|
547
|
+
'combined <- Effect.all([\n UserRepo.find("1"),\n OrderRepo.find("100"),\n], { concurrency: "unbounded" })',
|
|
548
|
+
["Effect.forEach"],
|
|
549
|
+
["all"],
|
|
550
|
+
],
|
|
551
|
+
"Effect.forEach": [
|
|
552
|
+
"effect",
|
|
553
|
+
"Effect.forEach(elements: Iterable<A>, f: (a: A) => Effect<B, E, R>, options: { concurrency: Option<Number> }): Effect<Array<B>, E, R>",
|
|
554
|
+
"Iterates over an iterable, applying an effectful function to each element.",
|
|
555
|
+
"Replaces imperative loops for effectful iteration. Can run sequentially or concurrently using the `concurrency` option.",
|
|
556
|
+
"results <- Effect.forEach(userIds, (id) => UserRepo.find(id), {\n concurrency: 5,\n})",
|
|
557
|
+
["Effect.all"],
|
|
558
|
+
["forEach"],
|
|
559
|
+
],
|
|
560
|
+
"Effect.die": [
|
|
561
|
+
"effect",
|
|
562
|
+
"Effect.die(defect: Unknown): Effect<Never>",
|
|
563
|
+
"Halts fiber execution immediately with an unrecoverable defect.",
|
|
564
|
+
"Terminates the current fiber with an uncatchable defect (system bug or assertion failure).",
|
|
565
|
+
'Effect.die(new Error("Fatal database corruption"))',
|
|
566
|
+
["Effect.orDie", "fail"],
|
|
567
|
+
["die"],
|
|
568
|
+
],
|
|
569
|
+
"Effect.orDie": [
|
|
570
|
+
"effect",
|
|
571
|
+
"Effect.orDie<A, E, R>(self: Effect<A, E, R>): Effect<A, never, R>",
|
|
572
|
+
"Demotes all typed errors in E into fatal defects.",
|
|
573
|
+
"Converts recoverable errors in the `E` channel into defects, asserting that the operation cannot fail.",
|
|
574
|
+
"safeVal = riskyOp |> Effect.orDie",
|
|
575
|
+
["Effect.die"],
|
|
576
|
+
["orDie"],
|
|
577
|
+
],
|
|
578
|
+
"Effect.retry": [
|
|
579
|
+
"effect",
|
|
580
|
+
"Effect.retry(policy: Schedule): Effect<...>",
|
|
581
|
+
"Retries a failing Effect according to a Schedule policy.",
|
|
582
|
+
"Automatically re-executes an Effect upon failure until the schedule policy dictates termination.",
|
|
583
|
+
"fetchWithRetry =\n apiCall\n |> Effect.retry(Schedule.exponential(Duration.millis(100)))",
|
|
584
|
+
["Schedule", "Effect.repeat"],
|
|
585
|
+
["retry"],
|
|
586
|
+
],
|
|
587
|
+
"Effect.repeat": [
|
|
588
|
+
"effect",
|
|
589
|
+
"Effect.repeat(policy: Schedule): Effect<...>",
|
|
590
|
+
"Repeats a successful Effect according to a Schedule policy.",
|
|
591
|
+
"Repeatedly executes an Effect as long as the Schedule allows.",
|
|
592
|
+
"pollStatus = checkHealth |> Effect.repeat(Schedule.spaced(Duration.seconds(10)))",
|
|
593
|
+
["Schedule", "Effect.retry"],
|
|
594
|
+
["repeat"],
|
|
595
|
+
],
|
|
596
|
+
"Effect.timeout": [
|
|
597
|
+
"effect",
|
|
598
|
+
"Effect.timeout(duration: Duration): Effect<Option<A>>",
|
|
599
|
+
"Enforces a maximum execution time on an Effect.",
|
|
600
|
+
"Aborts the Effect if it does not finish within the specified duration.",
|
|
601
|
+
"safeFetch = slowRequest |> Effect.timeout(Duration.seconds(3))",
|
|
602
|
+
["Duration"],
|
|
603
|
+
["timeout"],
|
|
604
|
+
],
|
|
605
|
+
"Effect.forkChild": [
|
|
606
|
+
"effect",
|
|
607
|
+
"Effect.forkChild<A, E, R>(self: Effect<A, E, R>): Effect<Fiber<A, E>, never, R>",
|
|
608
|
+
"Spawns an Effect onto a new concurrent background fiber.",
|
|
609
|
+
"Starts background execution of an Effect in an isolated green fiber.",
|
|
610
|
+
"fiber <- Effect.forkChild(backgroundTask)",
|
|
611
|
+
["Effect.forkScoped"],
|
|
612
|
+
["forkChild"],
|
|
613
|
+
],
|
|
614
|
+
"Effect.forkScoped": [
|
|
615
|
+
"effect",
|
|
616
|
+
"Effect.forkScoped<A, E>(self: Effect<A, E, R>): Effect<Fiber<A, E>, never, R | Scope>",
|
|
617
|
+
"Forks a fiber bound to the current Scope's lifetime.",
|
|
618
|
+
"Spawns a fiber that is automatically interrupted and cleaned up when the enclosing Scope closes.",
|
|
619
|
+
"scopedFiber <- Effect.forkScoped(longLivedService)",
|
|
620
|
+
["Effect.forkChild", "Effect.scoped"],
|
|
621
|
+
["forkScoped"],
|
|
622
|
+
],
|
|
623
|
+
"Effect.scoped": [
|
|
624
|
+
"effect",
|
|
625
|
+
"Effect.scoped<A, E, R>(self: Effect<A, E, R | Scope>): Effect<A, E, R>",
|
|
626
|
+
"Provides a new Scope to an Effect and closes it upon completion.",
|
|
627
|
+
"Creates an execution boundary for resources requiring deterministic cleanup (like files or sockets).",
|
|
628
|
+
"Effect.scoped(useTemporaryResource)",
|
|
629
|
+
["Effect.forkScoped", "Layer.scoped"],
|
|
630
|
+
[],
|
|
631
|
+
],
|
|
632
|
+
"Effect.runPromise": [
|
|
633
|
+
"effect",
|
|
634
|
+
"Effect.runPromise<A, E>(effect: Effect<A, E, never>): Promise<A>",
|
|
635
|
+
"Runs an Effect at the application boundary, returning a Promise.",
|
|
636
|
+
"Evaluates the Effect workflow to completion and resolves the resulting Promise with the success value. Only permitted in application entrypoints (`main`).",
|
|
637
|
+
"Effect.runPromise(mainProgram)",
|
|
638
|
+
["Effect.runSync"],
|
|
639
|
+
["runPromise"],
|
|
640
|
+
],
|
|
641
|
+
"Effect.runSync": [
|
|
642
|
+
"effect",
|
|
643
|
+
"Effect.runSync<A>(effect: Effect<A, never, never>): A",
|
|
644
|
+
"Synchronously executes an Effect that cannot fail and has no requirements.",
|
|
645
|
+
"Executes an Effect synchronously. Throws if the Effect contains asynchronous fibers or unresolved failures. Only permitted in application entrypoints (`main`).",
|
|
646
|
+
"result = Effect.runSync(pureCalculation)",
|
|
647
|
+
["Effect.runPromise"],
|
|
648
|
+
["runSync"],
|
|
649
|
+
],
|
|
650
|
+
Layer: [
|
|
651
|
+
"effect",
|
|
652
|
+
"type Layer<Out, Error = never, In = never>",
|
|
653
|
+
"Recipes for constructing, composing, and providing services.",
|
|
654
|
+
"A `Layer<Out, E, In>` specifies how to construct services `Out` given dependencies `In`. Layers enable modular dependency injection, memoization, parallel construction, and resource management.",
|
|
655
|
+
"export AppLive =\n UserRepoLive\n |> Layer.provide(DatabaseLive)",
|
|
656
|
+
["service", "Layer.succeed", "Layer.effect"],
|
|
657
|
+
],
|
|
658
|
+
"Layer.succeed": [
|
|
659
|
+
"effect",
|
|
660
|
+
"Layer.succeed<T>(tag: Service<T>, implementation: T): Layer<T>",
|
|
661
|
+
"Builds a Layer that provides a service with a static implementation.",
|
|
662
|
+
"Supplies a pre-constructed service implementation directly without asynchronous setup.",
|
|
663
|
+
'export GreeterLive =\n Layer.succeed(Greeter, {\n greet: (name) => Effect.succeed("Hello " + name),\n })',
|
|
664
|
+
["Layer", "Layer.effect", "service"],
|
|
665
|
+
],
|
|
666
|
+
"Layer.effect": [
|
|
667
|
+
"effect",
|
|
668
|
+
"Layer.effect<T, E, R>(tag: Service<T>, build: Effect<T, E, R>): Layer<T, E, R>",
|
|
669
|
+
"Builds a Layer that constructs a service via an Effect.",
|
|
670
|
+
"Allows effectful setup (e.g. connecting to a database, reading config) when instantiating a service.",
|
|
671
|
+
"export DbLive =\n Layer.effect(Database, effect {\n conn <- createConnection()\n => { query: (sql) => conn.execute(sql) }\n })",
|
|
672
|
+
["Layer", "Layer.succeed", "service"],
|
|
673
|
+
],
|
|
674
|
+
"Layer.scoped": [
|
|
675
|
+
"effect",
|
|
676
|
+
"Layer.scoped<T, E, R>(tag: Service<T>, build: Effect<T, E, R | Scope>): Layer<T, E, R>",
|
|
677
|
+
"Builds a Layer with managed lifecycle and resource cleanup.",
|
|
678
|
+
"Binds the constructed service to a Scope. The service will be automatically torn down when the layer is released.",
|
|
679
|
+
"Layer.scoped(ConnectionPool, acquirePool)",
|
|
680
|
+
["Layer", "Effect.scoped"],
|
|
681
|
+
],
|
|
682
|
+
Context: [
|
|
683
|
+
"effect",
|
|
684
|
+
"type Context<Services>",
|
|
685
|
+
"Type-safe environment container for service tags and instances.",
|
|
686
|
+
"Represents the dependency environment `R` in `Effect<A, E, R>`.",
|
|
687
|
+
"context = Context.empty()",
|
|
688
|
+
["service", "Layer"],
|
|
689
|
+
],
|
|
690
|
+
Schedule: [
|
|
691
|
+
"effect",
|
|
692
|
+
"type Schedule<Env, In, Out>",
|
|
693
|
+
"Recurrence policy defining repetition and retry behavior.",
|
|
694
|
+
"Configures delays, intervals, exponential backoffs, and iteration bounds for `retry` and `repeat`.",
|
|
695
|
+
"policy = Schedule.exponential(Duration.millis(100)) |> Schedule.compose(Schedule.recurs(5))",
|
|
696
|
+
["Effect.retry", "Effect.repeat", "Duration"],
|
|
697
|
+
],
|
|
698
|
+
pipe: [
|
|
699
|
+
"effect",
|
|
700
|
+
"pipe(value, f1, f2, ...): Result",
|
|
701
|
+
"Chains values through functions from left to right.",
|
|
702
|
+
"Utility function for data-first function composition. In FunkScript, the `|>` pipeline operator is preferred syntax and compiles down to `pipe` calls.",
|
|
703
|
+
"res = pipe(\n 5,\n (n) => n * 2,\n (n) => n + 1\n)",
|
|
704
|
+
["|>"],
|
|
705
|
+
],
|
|
706
|
+
"|>": [
|
|
707
|
+
"operator",
|
|
708
|
+
"expression |> function(args...)",
|
|
709
|
+
"Pipeline composition operator.",
|
|
710
|
+
"Passes the value of the left expression as the first argument (or into placeholder `_`) of the right expression. Compiles to `pipe(...)` or direct function invocation. Bare companion operations resolve only when the source proves a companion module. If multiple companions expose the name and the source is unproven, compilation reports the explicit namespaces to choose from.\n\nUntrusted dictionaries and payloads can be safely decoded directly using `payload |> decode(TargetSchema)`.",
|
|
711
|
+
'formatted =\n data\n |> Array.filter((x) => x > 0)\n |> Array.map((x) => x * 2)\n\ntransformed =\n Effect.succeed(1)\n |> map((value) => value + 1)\n |> timeout("1 second")\n\nvoted =\n rawPayload\n |> decode(VotePayload)',
|
|
712
|
+
["pipe", "Effect.map", "Effect.timeout"],
|
|
713
|
+
],
|
|
714
|
+
"|>>": [
|
|
715
|
+
"operator",
|
|
716
|
+
"expression |>> thunkFunction",
|
|
717
|
+
"Pass a deferred expression to a function.",
|
|
718
|
+
"Wraps the expression and earlier pipeline stages in a zero-argument function. The receiving function decides when and how often to evaluate it.",
|
|
719
|
+
"readFile(path) |>> try |> orDie\nmakePage() |>> sync",
|
|
720
|
+
["|>", "Effect.sync"],
|
|
721
|
+
],
|
|
722
|
+
"<-": [
|
|
723
|
+
"operator",
|
|
724
|
+
"binding <- effectExpression",
|
|
725
|
+
"Effect bind operator inside effect blocks.",
|
|
726
|
+
"Extracts the success value from an Effect within an `effect` block, short-circuiting on failure. Desugars to `yield*` in `Effect.gen`.",
|
|
727
|
+
"getName = effect {\n user <- UserRepo.find(id)\n => user.name\n}",
|
|
728
|
+
["effect", "Effect"],
|
|
729
|
+
],
|
|
730
|
+
"=>": [
|
|
731
|
+
"operator",
|
|
732
|
+
"(param: Type) => body",
|
|
733
|
+
"Function, match arm, and explicit return arrow.",
|
|
734
|
+
"Expression-bodied functions return their expression. Function and effect blocks end with an explicit `=> value`; match arms use `=>` to introduce their result.",
|
|
735
|
+
"add = (a: Number, b: Number): Number => a + b",
|
|
736
|
+
["effect"],
|
|
737
|
+
],
|
|
738
|
+
"???": [
|
|
739
|
+
"operator",
|
|
740
|
+
"??? [optionalMessage]",
|
|
741
|
+
"Typed hole placeholder for incomplete code.",
|
|
742
|
+
"A hole placeholder that satisfies any type at compile time but raises a diagnostic or throws an uncatchable defect at runtime if reached. Ideal for rapid prototyping.",
|
|
743
|
+
'todoImplementation = (input: string): Result => ??? "implement parser"',
|
|
744
|
+
["never"],
|
|
745
|
+
],
|
|
746
|
+
};
|
|
747
|
+
/** Complete examples checked against the lexer and parser in tests/reference-docs.test.ts. */
|
|
748
|
+
export const PARSED_DOC_EXAMPLES = [
|
|
749
|
+
"effect",
|
|
750
|
+
"and",
|
|
751
|
+
"not",
|
|
752
|
+
"js",
|
|
753
|
+
"<-",
|
|
754
|
+
"=>",
|
|
755
|
+
];
|
|
756
|
+
export const DOC_CATALOG = {};
|
|
757
|
+
for (const [name, [category, signature, summary, description, snippet, seeAlso, aliases],] of Object.entries(DOC_MAP)) {
|
|
758
|
+
DOC_CATALOG[name] = {
|
|
759
|
+
name,
|
|
760
|
+
category,
|
|
761
|
+
signature,
|
|
762
|
+
summary,
|
|
763
|
+
description,
|
|
764
|
+
snippet,
|
|
765
|
+
...(seeAlso ? { seeAlso } : {}),
|
|
766
|
+
...(aliases ? { aliases } : {}),
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Formats a DocItem into a standardized Markdown string for LSP Hover responses.
|
|
771
|
+
*/
|
|
772
|
+
export function formatDocToMarkdown(item) {
|
|
773
|
+
const parts = [];
|
|
774
|
+
parts.push("```funscript\n" + item.signature + "\n```");
|
|
775
|
+
parts.push("***");
|
|
776
|
+
parts.push(`**${item.name}** (\`${item.category}\`) — ${item.summary}`);
|
|
777
|
+
if (item.description)
|
|
778
|
+
parts.push(item.description);
|
|
779
|
+
if (item.snippet)
|
|
780
|
+
parts.push("### Example\n```funscript\n" + item.snippet + "\n```");
|
|
781
|
+
if (item.seeAlso && item.seeAlso.length > 0) {
|
|
782
|
+
parts.push(`**See also:** ${item.seeAlso.map((s) => "`" + s + "`").join(", ")}`);
|
|
783
|
+
}
|
|
784
|
+
return parts.join("\n\n");
|
|
785
|
+
}
|
|
786
|
+
const EXACT_MAP = new Map();
|
|
787
|
+
const LOWER_MAP = new Map();
|
|
788
|
+
for (const [key, item] of Object.entries(DOC_CATALOG)) {
|
|
789
|
+
EXACT_MAP.set(key, item);
|
|
790
|
+
const lower = key.toLowerCase();
|
|
791
|
+
if (!LOWER_MAP.has(lower) || key === lower) {
|
|
792
|
+
LOWER_MAP.set(lower, item);
|
|
793
|
+
}
|
|
794
|
+
if (item.aliases) {
|
|
795
|
+
for (const alias of item.aliases) {
|
|
796
|
+
EXACT_MAP.set(alias, item);
|
|
797
|
+
const aliasLower = alias.toLowerCase();
|
|
798
|
+
if (!LOWER_MAP.has(aliasLower) || alias === aliasLower) {
|
|
799
|
+
LOWER_MAP.set(aliasLower, item);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
export function getDocItem(keyword) {
|
|
805
|
+
if (!keyword || typeof keyword !== "string")
|
|
806
|
+
return null;
|
|
807
|
+
const trimmed = keyword.trim();
|
|
808
|
+
if (trimmed.length === 0)
|
|
809
|
+
return null;
|
|
810
|
+
if (EXACT_MAP.has(trimmed))
|
|
811
|
+
return EXACT_MAP.get(trimmed);
|
|
812
|
+
const lower = trimmed.toLowerCase();
|
|
813
|
+
if (LOWER_MAP.has(lower))
|
|
814
|
+
return LOWER_MAP.get(lower);
|
|
815
|
+
if (!trimmed.startsWith("Effect.") && EXACT_MAP.has("Effect." + trimmed)) {
|
|
816
|
+
return EXACT_MAP.get("Effect." + trimmed);
|
|
817
|
+
}
|
|
818
|
+
if (!lower.startsWith("effect.") && LOWER_MAP.has("effect." + lower)) {
|
|
819
|
+
return LOWER_MAP.get("effect." + lower);
|
|
820
|
+
}
|
|
821
|
+
return null;
|
|
822
|
+
}
|
|
823
|
+
export function getHoverDocumentation(keyword) {
|
|
824
|
+
const item = getDocItem(keyword);
|
|
825
|
+
return item ? formatDocToMarkdown(item) : null;
|
|
826
|
+
}
|
|
827
|
+
export function getAllDocKeywords() {
|
|
828
|
+
return Object.keys(DOC_CATALOG);
|
|
829
|
+
}
|
|
830
|
+
//# sourceMappingURL=docs.js.map
|