squiggle/packages/squiggle-lang/src/js/index.ts

18 lines
827 B
TypeScript
Raw Normal View History

2022-02-27 04:25:30 +00:00
import {runAll} from '../rescript/ProgramEvaluator.gen';
import type { Inputs_SamplingInputs_t as SamplingInputs, exportEnv, exportType, exportDistribution} from '../rescript/ProgramEvaluator.gen';
export type { SamplingInputs, exportEnv, exportDistribution }
2022-04-04 17:41:22 +00:00
export type {t as DistPlus} from '../rescript/OldInterpreter/DistPlus.gen';
export let defaultSamplingInputs : SamplingInputs = {
sampleCount : 10000,
outputXYPoints : 10000,
pointDistLength : 1000
}
2022-03-22 02:33:28 +00:00
export function run(squiggleString : string, samplingInputs? : SamplingInputs, environment?: exportEnv) : { tag: "Ok"; value: exportType }
| { tag: "Error"; value: string } {
let si : SamplingInputs = samplingInputs ? samplingInputs : defaultSamplingInputs
2022-03-22 02:33:28 +00:00
let env : exportEnv = environment ? environment : []
return runAll(squiggleString, si, env)
}