finally nailed the triggers! (I hope)

This commit is contained in:
Quinn Dougherty 2022-04-11 01:08:54 -04:00
parent d4b00b15c1
commit 3689caa1fc
2 changed files with 11 additions and 24 deletions

View File

@ -37,7 +37,7 @@ jobs:
name: Language lint
runs-on: ubuntu-latest
needs: pre_check
if: ${{ !needs.pre_check.outputs.should_skip_lang }}
if: ${{ needs.pre_check.outputs.should_skip_lang != 'true' }}
defaults:
run:
shell: bash
@ -91,7 +91,7 @@ jobs:
name: Website build
runs-on: ubuntu-latest
needs: pre_check
if: ${{ !(needs.pre_check.outputs.should_skip_website && needs.pre_check.outputs.should_skip_lang && needs.pre_check.outputs.should_skip_components) }}
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

View File

@ -121,17 +121,14 @@ module MathAdtToDistDst = {
| (_, _, Ok(mu), Ok(sigma)) => Ok(#FunctionCall("lognormal", [mu, sigma]))
| _ => Error("Lognormal distribution needs either mean and stdev or mu and sigma")
}
| _ =>
parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) =>
#FunctionCall("lognormal", args)
)
| _ => parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) => #FunctionCall("lognormal", args))
}
// Error("Dotwise exponentiation needs two operands")
let operationParser = (
name: string,
args: result<array<ASTTypes.node>, string>,
): result<ASTTypes.node, string> => {
let operationParser = (name: string, args: result<array<ASTTypes.node>, string>): result<
ASTTypes.node,
string,
> => {
let toOkAlgebraic = r => Ok(#AlgebraicCombination(r))
let toOkPointwise = r => Ok(#PointwiseCombination(r))
let toOkTruncate = r => Ok(#Truncate(r))
@ -169,10 +166,7 @@ module MathAdtToDistDst = {
}
let functionParser = (
nodeParser: MathJsonToMathJsAdt.arg => Belt.Result.t<
ASTTypes.node,
string,
>,
nodeParser: MathJsonToMathJsAdt.arg => Belt.Result.t<ASTTypes.node, string>,
name: string,
args: array<MathJsonToMathJsAdt.arg>,
): result<ASTTypes.node, string> => {
@ -224,17 +218,11 @@ module MathAdtToDistDst = {
)
Ok(hash)
}
| name =>
parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) =>
#FunctionCall(name, args)
)
| name => parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) => #FunctionCall(name, args))
}
}
let rec nodeParser: MathJsonToMathJsAdt.arg => result<
ASTTypes.node,
string,
> = x =>
let rec nodeParser: MathJsonToMathJsAdt.arg => result<ASTTypes.node, string> = x =>
switch x {
| Value(f) => Ok(#SymbolicDist(#Float(f)))
| Symbol(sym) => Ok(#Symbol(sym))
@ -267,8 +255,7 @@ module MathAdtToDistDst = {
blocks |> E.A.fmap(b => topLevel(b)) |> E.A.R.firstErrorOrOpen |> E.R.fmap(E.A.concatMany)
}
let run = (r): result<ASTTypes.program, string> =>
r |> MathAdtCleaner.run |> topLevel
let run = (r): result<ASTTypes.program, string> => r |> MathAdtCleaner.run |> topLevel
}
/* The MathJs parser doesn't support '.+' syntax, but we want it because it