diff --git a/packages/squiggle-lang/__tests__/JS__Test.ts b/packages/squiggle-lang/__tests__/JS__Test.ts index f9a037af..ffba5b82 100644 --- a/packages/squiggle-lang/__tests__/JS__Test.ts +++ b/packages/squiggle-lang/__tests__/JS__Test.ts @@ -1,8 +1,4 @@ -import { - run, - Distribution, - resultMap, -} from "../src/js/index"; +import { run, Distribution, resultMap } from "../src/js/index"; let testRun = (x: string) => { let result = run(x); @@ -14,7 +10,7 @@ let testRun = (x: string) => { }; function Ok(x: b) { - return { tag: "Ok", value: x} + return { tag: "Ok", value: x }; } describe("Simple calculations and results", () => { @@ -81,14 +77,16 @@ describe("Distribution", () => { }); test("algebraicAdd", () => { expect( - resultMap(dist.algebraicAdd(dist2), (r: Distribution) => r.toSparkline(20)) - .value + resultMap(dist.algebraicAdd(dist2), (r: Distribution) => + r.toSparkline(20) + ).value ).toEqual(Ok("▁▁▂▄▆████▇▆▄▄▃▃▃▂▁▁▁")); }); test("pointwiseAdd", () => { expect( - resultMap(dist.pointwiseAdd(dist2), (r: Distribution) => r.toSparkline(20)) - .value + resultMap(dist.pointwiseAdd(dist2), (r: Distribution) => + r.toSparkline(20) + ).value ).toEqual(Ok("▁▂▅██▅▅▅▆▇█▆▅▃▃▂▂▁▁▁")); }); }); diff --git a/packages/squiggle-lang/src/js/index.ts b/packages/squiggle-lang/src/js/index.ts index e904eb7b..8ff08228 100644 --- a/packages/squiggle-lang/src/js/index.ts +++ b/packages/squiggle-lang/src/js/index.ts @@ -185,7 +185,7 @@ export class Distribution { ); } - pointwiseAdd(d2: Distribution) { + pointwiseAdd(d2: Distribution): result { return this.mapResultDist( Constructors_pointwiseAdd({ env: this.env }, this.t, d2.t) );