diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7d618d44..13234dce 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -24,7 +24,7 @@ *.json @quinn-dougherty @Hazelfire @berekuk @OAGr *.y*ml @quinn-dougherty @berekuk @OAGr *.config.js @Hazelfire @berekuk @OAGr -netlify.toml @quinn-dougherty @OAGr @berekuk @Hazelfire +vercel.json @OAGr @berekuk @Hazelfire # Documentation *.md @quinn-dougherty @OAGr @Hazelfire diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8a3b026a..452fb0c2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,7 @@ Squiggle is currently pre-alpha. # Bug reports -Anyone (with a github account) can file an issue at any time. Please allow Quinn, Sam, and Ozzie to triage, but otherwise just follow the suggestions in the issue templates. +Anyone (with a github account) can file an issue at any time. Please allow Slava, Sam, and Ozzie to triage, but otherwise just follow the suggestions in the issue templates. # Project structure @@ -28,7 +28,7 @@ Squiggle is a **monorepo** with three **packages**. # Deployment ops -We use netlify, and it should only concern Quinn, Sam, and Ozzie. +We use Vercel, and it should only concern Slava, Sam, and Ozzie. # Development environment, building, testing, dev server @@ -56,9 +56,9 @@ If you absolutely must, please prefix your commit message with `hotfix: `. Please work against `develop` branch. **Do not** work against `master`. -- For rescript code: Quinn and Ozzie are reviewers +- For rescript code: Slava and Ozzie are reviewers - For js or typescript code: Sam and Ozzie are reviewers -- For ops code (i.e. yaml, package.json): Quinn and Sam are reviewers +- For ops code (i.e. yaml, package.json): Slava and Sam are reviewers Autopings are set up: if you are not autopinged, you are welcome to comment, but please do not use the formal review feature, send approvals, rejections, or merges. diff --git a/README.md b/README.md index e182f539..9b80cf33 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,10 @@ _An estimation language_. ## Our deployments -- **website/docs prod**: https://squiggle-language.com [![Netlify Status](https://api.netlify.com/api/v1/badges/2139af5c-671d-473d-a9f6-66c96077d8a1/deploy-status)](https://app.netlify.com/sites/squiggle-documentation/deploys) -- **website/docs staging**: https://develop--squiggle-documentation.netlify.app/ -- **components storybook prod**: https://squiggle-components.netlify.app/ [![Netlify Status](https://api.netlify.com/api/v1/badges/b7f724aa-6b20-4d0e-bf86-3fcd1a3e9a70/deploy-status)](https://app.netlify.com/sites/squiggle-components/deploys) -- **components storybook staging**: https://develop--squiggle-components.netlify.app/ +- **website/docs prod**: https://squiggle-language.com +- **website/docs staging**: https://preview.squiggle-language.com +- **components storybook prod**: https://components.squiggle-language.com +- **components storybook staging**: https://preview-components.squiggle-language.com - **legacy (2020) playground**: https://playground.squiggle-language.com ## Packages diff --git a/packages/components/netlify.toml b/packages/components/netlify.toml deleted file mode 100644 index d6e5474d..00000000 --- a/packages/components/netlify.toml +++ /dev/null @@ -1,8 +0,0 @@ -[build] - base = "packages/components/" - command = "cd ../squiggle-lang && yarn build && cd ../components && yarn build" - publish = "storybook-static/" - ignore = "node -e 'process.exitCode = process.env.BRANCH.includes(\"dependabot\") ? 0 : 1' && git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../squiggle-lang" - -[build.environment] - NETLIFY_USE_YARN = "true" diff --git a/packages/components/vercel.json b/packages/components/vercel.json new file mode 100644 index 00000000..71e5c36c --- /dev/null +++ b/packages/components/vercel.json @@ -0,0 +1,6 @@ +{ + "buildCommand": "cd ../squiggle-lang && yarn build && cd ../components && yarn build", + "outputDirectory": "storybook-static", + "installCommand": "cd ../../ && yarn", + "ignoreCommand": "git diff --quiet $VERCEL_GIT_PREVIOUS_SHA $VERCEL_GIT_COMMIT_SHA . ../squiggle-lang" +} diff --git a/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res b/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res index 99e3e5a3..84cf3ee5 100644 --- a/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res +++ b/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res @@ -3,7 +3,7 @@ This is the most basic file in our invariants family of tests. Validate that the addition of means equals the mean of the addition, similar for subtraction and multiplication. -Details in https://develop--squiggle-documentation.netlify.app/docs/internal/invariants/ +Details in https://squiggle-language.com/docs/internal/invariants/ Note: epsilon of 1e3 means the invariants are, in general, not being satisfied. */ diff --git a/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res b/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res index af2c3d7a..96ed2308 100644 --- a/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res +++ b/packages/squiggle-lang/__tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.res @@ -10,6 +10,8 @@ let examples = E.A.to_list(FunctionRegistry_Core.Registry.allExamples(registry)) describe("FunctionRegistry Library", () => { describe("Regular tests", () => { + testEvalToBe("List.length([3,5,8])", "Ok(3)") + testEvalToBe("List.length([])", "Ok(0)") testEvalToBe("List.make(3, 'HI')", "Ok(['HI','HI','HI'])") testEvalToBe("make(3, 'HI')", "Error(make is not defined)") testEvalToBe("List.upTo(1,3)", "Ok([1,2,3])") @@ -80,6 +82,10 @@ describe("FunctionRegistry Library", () => { "SampleSet.toList(SampleSet.mapN([SampleSet.fromList([1,2,3,4,5,6]), SampleSet.fromList([6, 5, 4, 3, 2, 1])], {|x| x[0] > x[1] ? x[0] : x[1]}))", "Ok([6,5,4,4,5,6])", ) + testEvalToBe( + "SampleSet.fromList([1, 2, 3])", + "Error(Error: Too few samples when constructing sample set)", + ) testEvalToBe("Dict.merge({a: 1, b: 2}, {b: 3, c: 4, d: 5})", "Ok({a: 1,b: 3,c: 4,d: 5})") testEvalToBe( diff --git a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res index 17fbe431..0bcd4ee9 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res @@ -4,13 +4,6 @@ module Error = { type sampleSetError = TooFewSamples | NonNumericInput(string) | OperationError(Operation.operationError) - let sampleSetErrorToString = (err: sampleSetError): string => - switch err { - | TooFewSamples => "Too few samples when constructing sample set" - | NonNumericInput(err) => `Found a non-number in input: ${err}` - | OperationError(err) => Operation.Error.toString(err) - } - @genType type pointsetConversionError = TooFewSamplesForConversionToPointSet diff --git a/packages/squiggle-lang/src/rescript/FR/FR_List.res b/packages/squiggle-lang/src/rescript/FR/FR_List.res index fdcacd0d..803bfc05 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_List.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_List.res @@ -5,6 +5,10 @@ let nameSpace = "List" let requiresNamespace = true module Internals = { + let length = (v: array): Reducer_T.value => IEvNumber( + Belt.Int.toFloat(Array.length(v)), + ) + let makeFromNumber = (n: float, value: Reducer_T.value): Reducer_T.value => IEvArray( Belt.Array.make(E.Float.toInt(n), value), ) @@ -75,6 +79,26 @@ module Internals = { } let library = [ + Function.make( + ~name="length", + ~nameSpace, + ~output=EvtNumber, + ~requiresNamespace=true, + ~examples=[`List.length([1,4,5])`], + ~definitions=[ + FnDefinition.make( + ~name="length", + ~inputs=[FRTypeArray(FRTypeAny)], + ~run=(inputs, _, _) => + switch inputs { + | [IEvArray(array)] => Internals.length(array)->Ok + | _ => Error(impossibleError) + }, + (), + ), + ], + (), + ), Function.make( ~name="make", ~nameSpace, diff --git a/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res b/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res index 40ce8714..ab50a04b 100644 --- a/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res +++ b/packages/squiggle-lang/src/rescript/FR/FR_Sampleset.res @@ -115,7 +115,7 @@ let libaryBase = [ ~run=(inputs, _, _) => { let sampleSet = inputs->Prepare.ToTypedArray.numbers - |> E.R2.bind(r => SampleSetDist.make(r)->E.R2.errMap(_ => "AM I HERE? WHYERE AMI??")) + |> E.R2.bind(r => SampleSetDist.make(r)->E.R2.errMap(SampleSetDist.Error.toString)) sampleSet ->E.R2.fmap(Wrappers.sampleSet) ->E.R2.fmap(Wrappers.evDistribution) diff --git a/packages/website/docs/Guides/Functions.mdx b/packages/website/docs/Guides/Functions.mdx index 98208954..5e62125f 100644 --- a/packages/website/docs/Guides/Functions.mdx +++ b/packages/website/docs/Guides/Functions.mdx @@ -181,7 +181,7 @@ The `sample(distribution)` samples a given distribution. ## Converting between distribution formats -Recall the [three formats of distributions](https://develop--squiggle-documentation.netlify.app/docs/Discussions/Three-Types-Of-Distributions). We can force any distribution into `SampleSet` format +Recall the [three formats of distributions](/docs/Discussions/Three-Formats-Of-Distributions). We can force any distribution into `SampleSet` format diff --git a/packages/website/docs/Guides/Language.mdx b/packages/website/docs/Guides/Language.mdx index 311ef6ba..6f439be4 100644 --- a/packages/website/docs/Guides/Language.mdx +++ b/packages/website/docs/Guides/Language.mdx @@ -86,11 +86,11 @@ c = 5 to 10 // namespace not required ""`} /> -## Number Prefixes +## Number Suffixes -Numbers support a few scientific notation prefixes. +Numbers support a few scientific notation suffixes. -| prefix | multiplier | +| suffix | multiplier | | ------ | ---------- | | n | 10^-9 | | m | 10^-3 | diff --git a/packages/website/docs/Integrations.md b/packages/website/docs/Integrations.md index d10a7e9a..3a0242b6 100644 --- a/packages/website/docs/Integrations.md +++ b/packages/website/docs/Integrations.md @@ -22,7 +22,7 @@ Types are available for both packages. This documentation uses `@quri/squiggle-components` frequently. -We host [a storybook](https://squiggle-components.netlify.app/) with details +We host [a storybook](https://components.squiggle-language.com) with details and usage of each of the components made available. ## [Visual Studio Code Extension](https://marketplace.visualstudio.com/items?itemName=QURI.vscode-squiggle) ![npm version](https://vsmarketplacebadge.apphb.com/version/QURI.vscode-squiggle.svg) diff --git a/packages/website/docs/Overview.mdx b/packages/website/docs/Overview.mdx index d00ef749..c71b64db 100644 --- a/packages/website/docs/Overview.mdx +++ b/packages/website/docs/Overview.mdx @@ -75,7 +75,7 @@ There's a simple [VS Code extension](https://marketplace.visualstudio.com/items? Squiggle is built using [Rescript](https://rescript-lang.org/), and is accessible via a simple Typescript library. You can use this library to either run Squiggle code in full, or to call select specific functions within Squiggle (though this latter functionality is very minimal). **[React Components Library](https://www.npmjs.com/package/@quri/squiggle-components)** -All of the components used in the playground and documentation are available in a separate component NPM repo. You can see the full Storybook of components [here](https://squiggle-components.netlify.app). +All of the components used in the playground and documentation are available in a separate component NPM repo. You can see the full Storybook of components [here](https://components.squiggle-language.com). **[Observable](https://observablehq.com/@hazelfire/squiggle)** You can use Squiggle Components in Observable notebooks. Sam Nolan put together an exportable [Observable Notebook](https://observablehq.com/@hazelfire/squiggle) of the key components that you can directly import and use in your Observable notebooks. diff --git a/packages/website/docusaurus.config.js b/packages/website/docusaurus.config.js index ffcb1e85..f1f426f7 100644 --- a/packages/website/docusaurus.config.js +++ b/packages/website/docusaurus.config.js @@ -76,6 +76,10 @@ const config = { // //... other Algolia params // }, + colorMode: { + // squiggle playground is not compatible with dark mode yet, see https://github.com/quantified-uncertainty/squiggle/issues/1192 + disableSwitch: true, + }, navbar: { title: "Squiggle", hideOnScroll: true, diff --git a/packages/website/netlify.toml b/packages/website/netlify.toml deleted file mode 100644 index cb064992..00000000 --- a/packages/website/netlify.toml +++ /dev/null @@ -1,8 +0,0 @@ -[build] - base = "packages/website/" - command = "cd ../squiggle-lang && yarn build && cd ../components && yarn build && cd ../website && yarn build" - publish = "build/" - ignore = "node -e 'process.exitCode = process.env.BRANCH.includes(\"dependabot\") ? 0 : 1' && git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ../" - -[build.environment] - NETLIFY_USE_YARN = "true" diff --git a/packages/website/vercel.json b/packages/website/vercel.json new file mode 100644 index 00000000..4efc99fd --- /dev/null +++ b/packages/website/vercel.json @@ -0,0 +1,6 @@ +{ + "buildCommand": "cd ../squiggle-lang && yarn build && cd ../components && yarn build && cd ../website && yarn build", + "framework": "docusaurus-2", + "installCommand": "cd ../../ && yarn", + "ignoreCommand": "git diff --quiet $VERCEL_GIT_PREVIOUS_SHA $VERCEL_GIT_COMMIT_SHA ../squiggle-lang ../components ." +}