From d6c541036fc8909bc3c8b3243db826792f75ee76 Mon Sep 17 00:00:00 2001 From: Sam Nolan Date: Mon, 11 Apr 2022 11:08:34 +1000 Subject: [PATCH] Run prettier + add missing pointWiseAdd signature --- packages/squiggle-lang/__tests__/JS__Test.ts | 18 ++++++++---------- packages/squiggle-lang/src/js/index.ts | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) 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) );