From 7237f2709b22e37225cb25447fbf989916b5e5f3 Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sat, 20 Aug 2022 20:32:41 -0700 Subject: [PATCH 1/8] First implementation of sampleSet mixed distribution --- .../Distributions/DistributionOperation.res | 2 +- .../rescript/Distributions/GenericDist.res | 21 ++++++++++++++++--- .../rescript/Distributions/GenericDist.resi | 1 + .../SampleSetDist/SampleSetDist.res | 12 +++++++++++ .../squiggle-lang/src/rescript/Utility/E.res | 1 + 5 files changed, 33 insertions(+), 4 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.res b/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.res index 319535c1..9c61211e 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.res +++ b/packages/squiggle-lang/src/rescript/Distributions/DistributionOperation.res @@ -216,7 +216,7 @@ let rec run = (~env: env, functionCallInfo: functionCallInfo): outputType => { | FromFloat(subFnName, x) => reCall(~functionCallInfo=FromFloat(subFnName, x), ()) | Mixture(dists) => dists - ->GenericDist.mixture(~scaleMultiplyFn=scaleMultiply, ~pointwiseAddFn=pointwiseAdd) + ->GenericDist.mixture(~scaleMultiplyFn=scaleMultiply, ~pointwiseAddFn=pointwiseAdd, ~env) ->E.R2.fmap(r => Dist(r)) ->OutputLocal.fromResult | FromSamples(xs) => diff --git a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res index f536d54d..0676ab44 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res @@ -491,15 +491,30 @@ let pointwiseCombinationFloat = ( m->E.R2.fmap(r => DistributionTypes.PointSet(r)) } -//Note: The result should always cumulatively sum to 1. This would be good to test. -//Note: If the inputs are not normalized, this will return poor results. The weights probably refer to the post-normalized forms. It would be good to apply a catch to this. +//TODO: The result should always cumulatively sum to 1. This would be good to test. +//TODO: If the inputs are not normalized, this will return poor results. The weights probably refer to the post-normalized forms. It would be good to apply a catch to this. let mixture = ( values: array<(t, float)>, ~scaleMultiplyFn: scaleMultiplyFn, ~pointwiseAddFn: pointwiseAddFn, + ~env: env, ) => { - if E.A.length(values) == 0 { + let allValuesAreSampleSet = v => E.A.all(((t, _)) => isSampleSetSet(t), v) + + if E.A.isEmpty(values) { Error(DistributionTypes.OtherError("Mixture error: mixture must have at least 1 element")) + } else if allValuesAreSampleSet(values) { + let withSampleSetValues = values->E.A2.fmap(((value, weight)) => + switch value { + | SampleSet(sampleSet) => Ok((sampleSet, weight)) + | _ => Error("Unreachable") + } |> E.R.toExn("Mixture coding error: SampleSet expected. This should be inaccessible.") + ) + let sampleSetMixture = SampleSetDist.mixture(withSampleSetValues, env.sampleCount) + switch sampleSetMixture { + | Ok(sampleSet) => Ok(DistributionTypes.SampleSet(sampleSet)) + | Error(err) => Error(DistributionTypes.Error.sampleErrorToDistErr(err)) + } } else { let totalWeight = values->E.A2.fmap(E.Tuple2.second)->E.A.Floats.sum let properlyWeightedValues = diff --git a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.resi b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.resi index fd04212a..94fe44ad 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.resi +++ b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.resi @@ -81,6 +81,7 @@ let mixture: ( array<(t, float)>, ~scaleMultiplyFn: scaleMultiplyFn, ~pointwiseAddFn: pointwiseAddFn, + ~env: env, ) => result let isSymbolic: t => bool diff --git a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res index dc15f7a1..f8e93df1 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res @@ -131,3 +131,15 @@ let max = t => T.get(t)->E.A.Floats.max let stdev = t => T.get(t)->E.A.Floats.stdev let variance = t => T.get(t)->E.A.Floats.variance let percentile = (t, f) => T.get(t)->E.A.Floats.percentile(f) + +let mixture = (values: array<(t, float)>, intendedLength: int) => { + let totalWeight = values->E.A2.fmap(E.Tuple2.second)->E.A.Floats.sum + values + ->E.A2.fmap(((dist, weight)) => { + let adjustedWeight = weight /. totalWeight + let samplesToGet = adjustedWeight *. E.I.toFloat(intendedLength) |> E.Float.toInt + sampleN(dist, samplesToGet) + }) + ->E.A.concatMany + ->T.make +} diff --git a/packages/squiggle-lang/src/rescript/Utility/E.res b/packages/squiggle-lang/src/rescript/Utility/E.res index 22c8c525..5930db23 100644 --- a/packages/squiggle-lang/src/rescript/Utility/E.res +++ b/packages/squiggle-lang/src/rescript/Utility/E.res @@ -220,6 +220,7 @@ module I = { let increment = n => n + 1 let decrement = n => n - 1 let toString = Js.Int.toString + let toFloat = Js.Int.toFloat } exception Assertion(string) From e1efefaf7d293de988ad0db8de998cf514a67e4f Mon Sep 17 00:00:00 2001 From: Ozzie Gooen Date: Sun, 21 Aug 2022 21:45:05 -0700 Subject: [PATCH 2/8] Added sampleN from Stdlib to allow for correct sampling of discrete distributions --- .../squiggle-lang/__tests__/Stdlib_test.res | 16 +++++++++++++ packages/squiggle-lang/package.json | 1 + .../Distributions/PointSetDist/Discrete.res | 5 ++++ .../PointSetDist/PointSetDist.res | 4 ++++ .../SampleSetDist/SampleSetDist.res | 23 ++++++++++++------- .../src/rescript/Utility/Stdlib.res | 8 +++++++ 6 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 packages/squiggle-lang/__tests__/Stdlib_test.res diff --git a/packages/squiggle-lang/__tests__/Stdlib_test.res b/packages/squiggle-lang/__tests__/Stdlib_test.res new file mode 100644 index 00000000..6b571fab --- /dev/null +++ b/packages/squiggle-lang/__tests__/Stdlib_test.res @@ -0,0 +1,16 @@ +open Jest +open Expect + +let makeTest = (~only=false, str, item1, item2) => + only + ? Only.test(str, () => expect(item1)->toEqual(item2)) + : test(str, () => expect(item1)->toEqual(item2)) + +describe("Stdlib", () => { + makeTest("min", Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10}) |> E.A.length, 10) + makeTest( + "min", + Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10}) |> E.A.uniq |> E.A.Floats.sort, + [1.0, 2.0], + ) +}) diff --git a/packages/squiggle-lang/package.json b/packages/squiggle-lang/package.json index a94197f8..164d62de 100644 --- a/packages/squiggle-lang/package.json +++ b/packages/squiggle-lang/package.json @@ -18,6 +18,7 @@ "benchmark": "ts-node benchmark/conversion_tests.ts", "test": "jest", "test:ts": "jest __tests__/TS/", + "test:stdlib": "jest __tests__/Stdlib_test.bs.js", "test:rescript": "jest --modulePathIgnorePatterns=__tests__/TS/*", "test:watch": "jest --watchAll", "test:fnRegistry": "jest __tests__/SquiggleLibrary/SquiggleLibrary_FunctionRegistryLibrary_test.bs.js", diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res index b7d5ffd4..ba708f0b 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res @@ -224,3 +224,8 @@ module T = Dist({ XYShape.Analysis.getVarianceDangerously(t, mean, getMeanOfSquares) } }) + +let sampleN = (t: t, n): array => { + let normalized = t |> T.normalize |> getShape + Stdlib.Random.sample(normalized.xs, {probs: normalized.ys, size: n}) +} diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res index 6fd2582d..bbf2b074 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res @@ -257,3 +257,7 @@ let toSparkline = (t: t, bucketCount): resultE.O2.fmap(Continuous.downsampleEquallyOverX(bucketCount)) ->E.O2.toResult(PointSetTypes.CannotSparklineDiscrete) ->E.R2.fmap(r => Continuous.getShape(r).ys->Sparklines.create()) + +let makeDiscrete = (d):t => Discrete(d) +let makeContinuous = (d):t => Continuous(d) +let makeMixed = (d):t => Mixed(d) \ No newline at end of file diff --git a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res index f8e93df1..8ad2cbef 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res @@ -134,12 +134,19 @@ let percentile = (t, f) => T.get(t)->E.A.Floats.percentile(f) let mixture = (values: array<(t, float)>, intendedLength: int) => { let totalWeight = values->E.A2.fmap(E.Tuple2.second)->E.A.Floats.sum - values - ->E.A2.fmap(((dist, weight)) => { - let adjustedWeight = weight /. totalWeight - let samplesToGet = adjustedWeight *. E.I.toFloat(intendedLength) |> E.Float.toInt - sampleN(dist, samplesToGet) - }) - ->E.A.concatMany - ->T.make + let discreteSamples = + values + ->Belt.Array.mapWithIndex((i, (_, weight)) => (E.I.toFloat(i), weight /. totalWeight)) + ->XYShape.T.fromZippedArray + ->Discrete.make + ->Discrete.sampleN(intendedLength) + let dists = values->E.A2.fmap(E.Tuple2.first)->E.A2.fmap(T.get) + let samples = + discreteSamples + ->Belt.Array.mapWithIndex((index, distIndexToChoose) => { + let chosenDist = E.A.get(dists, E.Float.toInt(distIndexToChoose)) + chosenDist |> E.O2.bind(E.A.get(_, index)) + }) + ->E.A.O.openIfAllSome + (samples |> E.O.toExn("Mixture unreachable error"))->T.make } diff --git a/packages/squiggle-lang/src/rescript/Utility/Stdlib.res b/packages/squiggle-lang/src/rescript/Utility/Stdlib.res index faa1cb1d..a0bde73d 100644 --- a/packages/squiggle-lang/src/rescript/Utility/Stdlib.res +++ b/packages/squiggle-lang/src/rescript/Utility/Stdlib.res @@ -38,3 +38,11 @@ module Logistic = { @module external variance: (float, float) => float = "@stdlib/stats/base/dists/logistic/variance" let variance = variance } + +module Random = { + type sampleArgs = { + probs: array, + size: int, + } + @module external sample: (array, sampleArgs) => array = "@stdlib/random/sample" +} \ No newline at end of file From 989fa9644a336de843d2730fccd2f12f93d6424b Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Thu, 1 Sep 2022 12:48:07 +0800 Subject: [PATCH 3/8] rm `|>` in favor of `->` --- .../rescript/Distributions/SampleSetDist/SampleSetDist.res | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res index 8c8b6f7e..c0d6e4bf 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res @@ -145,10 +145,10 @@ let mixture = (values: array<(t, float)>, intendedLength: int) => { discreteSamples ->Belt.Array.mapWithIndex((index, distIndexToChoose) => { let chosenDist = E.A.get(dists, E.Float.toInt(distIndexToChoose)) - chosenDist |> E.O2.bind(E.A.get(_, index)) + chosenDist -> E.O.bind(E.A.get(_, index)) }) ->E.A.O.openIfAllSome - (samples |> E.O.toExn("Mixture unreachable error"))->T.make + (samples -> E.O2.toExn("Mixture unreachable error"))->T.make } let truncateLeft = (t, f) => T.get(t)->E.A2.filter(x => x >= f)->T.make From 9366ce61f3ac8bca94bd78089403a23de23c1761 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Thu, 1 Sep 2022 12:48:20 +0800 Subject: [PATCH 4/8] `yarn format` compels me --- .../rescript/Distributions/PointSetDist/PointSetDist.res | 6 +++--- .../rescript/Distributions/SampleSetDist/SampleSetDist.res | 4 ++-- packages/squiggle-lang/src/rescript/Utility/Stdlib.res | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res index bbf2b074..a52ee784 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/PointSetDist.res @@ -258,6 +258,6 @@ let toSparkline = (t: t, bucketCount): resultE.O2.toResult(PointSetTypes.CannotSparklineDiscrete) ->E.R2.fmap(r => Continuous.getShape(r).ys->Sparklines.create()) -let makeDiscrete = (d):t => Discrete(d) -let makeContinuous = (d):t => Continuous(d) -let makeMixed = (d):t => Mixed(d) \ No newline at end of file +let makeDiscrete = (d): t => Discrete(d) +let makeContinuous = (d): t => Continuous(d) +let makeMixed = (d): t => Mixed(d) diff --git a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res index c0d6e4bf..364ecc56 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/SampleSetDist/SampleSetDist.res @@ -145,10 +145,10 @@ let mixture = (values: array<(t, float)>, intendedLength: int) => { discreteSamples ->Belt.Array.mapWithIndex((index, distIndexToChoose) => { let chosenDist = E.A.get(dists, E.Float.toInt(distIndexToChoose)) - chosenDist -> E.O.bind(E.A.get(_, index)) + chosenDist->E.O.bind(E.A.get(_, index)) }) ->E.A.O.openIfAllSome - (samples -> E.O2.toExn("Mixture unreachable error"))->T.make + samples->E.O2.toExn("Mixture unreachable error")->T.make } let truncateLeft = (t, f) => T.get(t)->E.A2.filter(x => x >= f)->T.make diff --git a/packages/squiggle-lang/src/rescript/Utility/Stdlib.res b/packages/squiggle-lang/src/rescript/Utility/Stdlib.res index a0bde73d..bc7046ce 100644 --- a/packages/squiggle-lang/src/rescript/Utility/Stdlib.res +++ b/packages/squiggle-lang/src/rescript/Utility/Stdlib.res @@ -45,4 +45,4 @@ module Random = { size: int, } @module external sample: (array, sampleArgs) => array = "@stdlib/random/sample" -} \ No newline at end of file +} From ab5b54413bc7ee9b6ea699dc74c5a7e4d63c5338 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Thu, 1 Sep 2022 12:54:04 +0800 Subject: [PATCH 5/8] it string in tests --- packages/squiggle-lang/__tests__/Stdlib_test.res | 10 +++++++--- .../rescript/Distributions/PointSetDist/Discrete.res | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/squiggle-lang/__tests__/Stdlib_test.res b/packages/squiggle-lang/__tests__/Stdlib_test.res index 6b571fab..5919f3b4 100644 --- a/packages/squiggle-lang/__tests__/Stdlib_test.res +++ b/packages/squiggle-lang/__tests__/Stdlib_test.res @@ -7,10 +7,14 @@ let makeTest = (~only=false, str, item1, item2) => : test(str, () => expect(item1)->toEqual(item2)) describe("Stdlib", () => { - makeTest("min", Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10}) |> E.A.length, 10) makeTest( - "min", - Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10}) |> E.A.uniq |> E.A.Floats.sort, + "Length of Random.sample", + Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10})->E.A.length, + 10, + ) + makeTest( + "Random.sample returns elements from input array (will fail with very slim probability)", + Stdlib.Random.sample([1.0, 2.0], {probs: [0.5, 0.5], size: 10})->E.A.uniq->E.A.Floats.sort, [1.0, 2.0], ) }) diff --git a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res index ba708f0b..7142f097 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res +++ b/packages/squiggle-lang/src/rescript/Distributions/PointSetDist/Discrete.res @@ -226,6 +226,6 @@ module T = Dist({ }) let sampleN = (t: t, n): array => { - let normalized = t |> T.normalize |> getShape + let normalized = t->T.normalize->getShape Stdlib.Random.sample(normalized.xs, {probs: normalized.ys, size: n}) } From ab9a83bcf7d306601b7112650f2a728cd6817970 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Thu, 1 Sep 2022 13:07:13 +0800 Subject: [PATCH 6/8] I think we're done here? --- .../squiggle-lang/src/rescript/Distributions/GenericDist.res | 2 +- packages/squiggle-lang/src/rescript/Utility/Stdlib.res | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res index 9db131da..0c279a9c 100644 --- a/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res +++ b/packages/squiggle-lang/src/rescript/Distributions/GenericDist.res @@ -516,7 +516,7 @@ let mixture = ( switch value { | SampleSet(sampleSet) => Ok((sampleSet, weight)) | _ => Error("Unreachable") - } |> E.R.toExn("Mixture coding error: SampleSet expected. This should be inaccessible.") + }->E.R2.toExn("Mixture coding error: SampleSet expected. This should be inaccessible.") ) let sampleSetMixture = SampleSetDist.mixture(withSampleSetValues, env.sampleCount) switch sampleSetMixture { diff --git a/packages/squiggle-lang/src/rescript/Utility/Stdlib.res b/packages/squiggle-lang/src/rescript/Utility/Stdlib.res index bc7046ce..ee43e681 100644 --- a/packages/squiggle-lang/src/rescript/Utility/Stdlib.res +++ b/packages/squiggle-lang/src/rescript/Utility/Stdlib.res @@ -45,4 +45,5 @@ module Random = { size: int, } @module external sample: (array, sampleArgs) => array = "@stdlib/random/sample" + let sample = sample } From 57dca26d2bfdf5c228c1f0e67f1f7d3c291234d2 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Thu, 1 Sep 2022 14:08:14 +0800 Subject: [PATCH 7/8] fix the resolve to `@stdlib/buffer` --- packages/squiggle-lang/webpack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/squiggle-lang/webpack.config.js b/packages/squiggle-lang/webpack.config.js index c352544d..483980c3 100644 --- a/packages/squiggle-lang/webpack.config.js +++ b/packages/squiggle-lang/webpack.config.js @@ -14,6 +14,7 @@ module.exports = { }, resolve: { extensions: [".tsx", ".ts", ".js"], + fallback: { "buffer": [ "@stdlib/buffer" ] } }, output: { filename: "bundle.js", From 38d0ea79e4a8705d366e0b6b990b72b3dabae7ab Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Thu, 1 Sep 2022 14:22:32 +0800 Subject: [PATCH 8/8] `yarn format:all` compels me --- .github/workflows/ci.yml | 219 +++++++++++------------ packages/squiggle-lang/webpack.config.js | 2 +- 2 files changed, 110 insertions(+), 111 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2663eb54..a2d0ef16 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,26 +49,26 @@ jobs: with: paths: '["packages/cli/**"]' -# lang-lint: -# name: Language lint -# runs-on: ubuntu-latest -# needs: pre_check -# if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }} -# defaults: -# run: -# shell: bash -# working-directory: packages/squiggle-lang -# steps: -# - uses: actions/checkout@v3 -# - name: Install Dependencies -# run: cd ../../ && yarn -# - name: Check rescript lint -# run: yarn lint:rescript -# - name: Check javascript, typescript, and markdown lint -# uses: creyD/prettier_action@v4.2 -# with: -# dry: true -# prettier_options: --check packages/squiggle-lang + # lang-lint: + # name: Language lint + # runs-on: ubuntu-latest + # needs: pre_check + # if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }} + # defaults: + # run: + # shell: bash + # working-directory: packages/squiggle-lang + # steps: + # - uses: actions/checkout@v3 + # - name: Install Dependencies + # run: cd ../../ && yarn + # - name: Check rescript lint + # run: yarn lint:rescript + # - name: Check javascript, typescript, and markdown lint + # uses: creyD/prettier_action@v4.2 + # with: + # dry: true + # prettier_options: --check packages/squiggle-lang lang-build-test-bundle: name: Language build, test, and bundle @@ -98,96 +98,96 @@ jobs: - name: Upload typescript coverage report run: yarn coverage:ts:ci -# components-lint: -# name: Components lint -# runs-on: ubuntu-latest -# needs: pre_check -# if: ${{ needs.pre_check.outputs.should_skip_components != 'true' }} -# defaults: -# run: -# shell: bash -# working-directory: packages/components -# steps: -# - uses: actions/checkout@v3 -# - name: Check javascript, typescript, and markdown lint -# uses: creyD/prettier_action@v4.2 -# with: -# dry: true -# prettier_options: --check packages/components --ignore-path packages/components/.prettierignore -# -# components-bundle-build: -# name: Components bundle and build -# runs-on: ubuntu-latest -# needs: pre_check -# if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }} -# defaults: -# run: -# shell: bash -# working-directory: packages/components -# steps: -# - uses: actions/checkout@v3 -# - name: Install dependencies from monorepo level -# run: cd ../../ && yarn -# - name: Build rescript codebase in squiggle-lang -# run: cd ../squiggle-lang && yarn build -# - name: Run webpack -# run: yarn bundle -# - name: Build storybook -# run: yarn build + # components-lint: + # name: Components lint + # runs-on: ubuntu-latest + # needs: pre_check + # if: ${{ needs.pre_check.outputs.should_skip_components != 'true' }} + # defaults: + # run: + # shell: bash + # working-directory: packages/components + # steps: + # - uses: actions/checkout@v3 + # - name: Check javascript, typescript, and markdown lint + # uses: creyD/prettier_action@v4.2 + # with: + # dry: true + # prettier_options: --check packages/components --ignore-path packages/components/.prettierignore + # + # components-bundle-build: + # name: Components bundle and build + # runs-on: ubuntu-latest + # needs: pre_check + # if: ${{ (needs.pre_check.outputs.should_skip_components != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') }} + # defaults: + # run: + # shell: bash + # working-directory: packages/components + # steps: + # - uses: actions/checkout@v3 + # - name: Install dependencies from monorepo level + # run: cd ../../ && yarn + # - name: Build rescript codebase in squiggle-lang + # run: cd ../squiggle-lang && yarn build + # - name: Run webpack + # run: yarn bundle + # - name: Build storybook + # run: yarn build -# website-lint: -# name: Website lint -# runs-on: ubuntu-latest -# needs: pre_check -# if: ${{ needs.pre_check.outputs.should_skip_website != 'true' }} -# defaults: -# run: -# shell: bash -# working-directory: packages/website -# steps: -# - uses: actions/checkout@v3 -# - name: Check javascript, typescript, and markdown lint -# uses: creyD/prettier_action@v4.2 -# with: -# dry: true -# prettier_options: --check packages/website -# -# website-build: -# name: Website build -# runs-on: ubuntu-latest -# needs: pre_check -# if: ${{ (needs.pre_check.outputs.should_skip_website != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') || (needs.pre_check.outputs.should_skip_components != 'true') }} -# defaults: -# run: -# shell: bash -# working-directory: packages/website -# steps: -# - uses: actions/checkout@v3 -# - name: Install dependencies from monorepo level -# run: cd ../../ && yarn -# - name: Build rescript in squiggle-lang -# run: cd ../squiggle-lang && yarn build -# - name: Build components -# run: cd ../components && yarn build -# - name: Build website assets -# run: yarn build -# -# vscode-ext-lint: -# name: VS Code extension lint -# runs-on: ubuntu-latest -# needs: pre_check -# if: ${{ needs.pre_check.outputs.should_skip_vscodeext != 'true' }} -# defaults: -# run: -# shell: bash -# working-directory: packages/vscode-ext -# steps: -# - uses: actions/checkout@v3 -# - name: Check javascript, typescript, and markdown lint -# uses: creyD/prettier_action@v4.2 -# with: -# dry: true -# prettier_options: --check packages/vscode-ext + # website-lint: + # name: Website lint + # runs-on: ubuntu-latest + # needs: pre_check + # if: ${{ needs.pre_check.outputs.should_skip_website != 'true' }} + # defaults: + # run: + # shell: bash + # working-directory: packages/website + # steps: + # - uses: actions/checkout@v3 + # - name: Check javascript, typescript, and markdown lint + # uses: creyD/prettier_action@v4.2 + # with: + # dry: true + # prettier_options: --check packages/website + # + # website-build: + # name: Website build + # runs-on: ubuntu-latest + # needs: pre_check + # if: ${{ (needs.pre_check.outputs.should_skip_website != 'true') || (needs.pre_check.outputs.should_skip_lang != 'true') || (needs.pre_check.outputs.should_skip_components != 'true') }} + # defaults: + # run: + # shell: bash + # working-directory: packages/website + # steps: + # - uses: actions/checkout@v3 + # - name: Install dependencies from monorepo level + # run: cd ../../ && yarn + # - name: Build rescript in squiggle-lang + # run: cd ../squiggle-lang && yarn build + # - name: Build components + # run: cd ../components && yarn build + # - name: Build website assets + # run: yarn build + # + # vscode-ext-lint: + # name: VS Code extension lint + # runs-on: ubuntu-latest + # needs: pre_check + # if: ${{ needs.pre_check.outputs.should_skip_vscodeext != 'true' }} + # defaults: + # run: + # shell: bash + # working-directory: packages/vscode-ext + # steps: + # - uses: actions/checkout@v3 + # - name: Check javascript, typescript, and markdown lint + # uses: creyD/prettier_action@v4.2 + # with: + # dry: true + # prettier_options: --check packages/vscode-ext vscode-ext-build: name: VS Code extension build @@ -204,7 +204,6 @@ jobs: run: cd ../../ && yarn - name: Build run: yarn compile - # cli-lint: # name: CLI lint # runs-on: ubuntu-latest diff --git a/packages/squiggle-lang/webpack.config.js b/packages/squiggle-lang/webpack.config.js index 483980c3..e1e0675e 100644 --- a/packages/squiggle-lang/webpack.config.js +++ b/packages/squiggle-lang/webpack.config.js @@ -14,7 +14,7 @@ module.exports = { }, resolve: { extensions: [".tsx", ".ts", ".js"], - fallback: { "buffer": [ "@stdlib/buffer" ] } + fallback: { buffer: ["@stdlib/buffer"] }, }, output: { filename: "bundle.js",