Merge branch 'develop' into contributing-april-update
This commit is contained in:
commit
41288ed3ff
18
.github/CODEOWNERS
vendored
18
.github/CODEOWNERS
vendored
|
@ -8,15 +8,23 @@
|
||||||
# IMPORTANT NOTE: in order to actually get pinged, commit access is required.
|
# IMPORTANT NOTE: in order to actually get pinged, commit access is required.
|
||||||
# This also holds true for GitHub teams.
|
# This also holds true for GitHub teams.
|
||||||
|
|
||||||
# This file
|
# Rescript
|
||||||
/.github/CODEOWNERS @quinn-dougherty
|
|
||||||
|
|
||||||
# Any rescript code
|
|
||||||
*.res @Hazelfire @OAGr @quinn-dougherty
|
*.res @Hazelfire @OAGr @quinn-dougherty
|
||||||
|
*.resi @Hazelfire @OAGr @quinn-dougherty
|
||||||
|
|
||||||
# Any typescript code
|
# Typescript
|
||||||
*.tsx @Hazelfire @OAGr
|
*.tsx @Hazelfire @OAGr
|
||||||
|
*.ts @Hazelfire @OAGr
|
||||||
|
|
||||||
|
# Javascript
|
||||||
|
*.js @Hazelfire
|
||||||
|
|
||||||
# Any opsy files
|
# Any opsy files
|
||||||
|
.github/* @quinn-dougherty
|
||||||
*.json @quinn-dougherty @Hazelfire
|
*.json @quinn-dougherty @Hazelfire
|
||||||
*.y*ml @quinn-dougherty
|
*.y*ml @quinn-dougherty
|
||||||
|
*.config.js @Hazelfire
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
*.md @quinn-dougherty @OAGr @Hazelfire
|
||||||
|
*.mdx @quinn-dougherty @OAGr @Hazelfire
|
||||||
|
|
9
.github/ISSUE_TEMPLATE/developer-bug.md
vendored
9
.github/ISSUE_TEMPLATE/developer-bug.md
vendored
|
@ -1,14 +1,13 @@
|
||||||
---
|
---
|
||||||
name: Developer friction when contributing to Squiggle
|
name: Developer friction when contributing to Squiggle
|
||||||
about: Did your yarn scripts fail? Did the CI diverge from a README? Have a testing-related task? Etc.
|
about: Have a testing-related task? Did your yarn scripts fail? Did the CI diverge from a README? Etc.
|
||||||
labels: 'ops & testing'
|
labels: "ops & testing"
|
||||||
---
|
---
|
||||||
|
|
||||||
# Description:
|
# Description:
|
||||||
|
|
||||||
|
|
||||||
# The OS and version, yarn version, etc. in which this came up
|
# The OS and version, yarn version, etc. in which this came up
|
||||||
|
|
||||||
_delete this section if testing task_
|
_delete this section if testing task_
|
||||||
|
|
||||||
# Desired behavior
|
# Desired behavior
|
||||||
|
|
||||||
|
|
||||||
|
|
3
.github/ISSUE_TEMPLATE/future.md
vendored
3
.github/ISSUE_TEMPLATE/future.md
vendored
|
@ -2,6 +2,5 @@
|
||||||
name: Idea or feature request
|
name: Idea or feature request
|
||||||
about: Where would you like to see Squiggle go over the next few months, several months, or few years?
|
about: Where would you like to see Squiggle go over the next few months, several months, or few years?
|
||||||
---
|
---
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
|
|
||||||
|
|
||||||
|
|
13
.github/ISSUE_TEMPLATE/pl.md
vendored
13
.github/ISSUE_TEMPLATE/pl.md
vendored
|
@ -1,14 +1,13 @@
|
||||||
---
|
---
|
||||||
name: Regarding the programming language
|
name: Regarding the programming language
|
||||||
about: Interpreter, parser, syntax, semantics, and including distributions
|
about: Interpreter, parser, syntax, semantics, and including distributions
|
||||||
labels: 'programming language'
|
labels: "programming language"
|
||||||
---
|
---
|
||||||
|
|
||||||
<!-- mark one with an x -->
|
<!-- mark one with an x -->
|
||||||
- _ Is refactor
|
|
||||||
- _ Is new feature
|
- \_ Is refactor
|
||||||
- _ Concerns documentation
|
- \_ Is new feature
|
||||||
|
- \_ Concerns documentation
|
||||||
|
|
||||||
# Description of suggestion or shortcoming:
|
# Description of suggestion or shortcoming:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
7
.github/ISSUE_TEMPLATE/user-bug.md
vendored
7
.github/ISSUE_TEMPLATE/user-bug.md
vendored
|
@ -1,18 +1,17 @@
|
||||||
---
|
---
|
||||||
name: Bug reports for Squiggle users
|
name: Bug reports for Squiggle users
|
||||||
about: Rendering oddly, trouble with the playground, something like this?
|
about: Rendering oddly, trouble with the playground, something like this?
|
||||||
labels: 'bug'
|
labels: "bug"
|
||||||
---
|
---
|
||||||
|
|
||||||
# Description:
|
# Description:
|
||||||
|
|
||||||
|
|
||||||
# Steps to reproduce:
|
# Steps to reproduce:
|
||||||
|
|
||||||
1.
|
1.
|
||||||
2.
|
2.
|
||||||
3.
|
3.
|
||||||
|
|
||||||
# Expected behavior:
|
# Expected behavior:
|
||||||
|
|
||||||
|
|
||||||
# What I got instead:
|
# What I got instead:
|
||||||
|
|
||||||
|
|
92
.github/workflows/ci.yaml
vendored
92
.github/workflows/ci.yaml
vendored
|
@ -1,92 +0,0 @@
|
||||||
name: Squiggle packages check
|
|
||||||
|
|
||||||
on:
|
|
||||||
push: # Delete this line if there becomes a scarcity of build minutes.
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- staging
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
pre_check:
|
|
||||||
name: Precheck for skipping redundant jobs
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
should_skip_lang: ${{ steps.skip_lang_check.outputs.should_skip }}
|
|
||||||
should_skip_components: ${{ steps.skip_components_check.outputs.should_skip }}
|
|
||||||
should_skip_website: ${{ steps.skip_website_check.outputs.should_skip }}
|
|
||||||
steps:
|
|
||||||
- id: skip_lang_check
|
|
||||||
name: Check if the changes are about squiggle-lang src files
|
|
||||||
uses: fkirc/skip-duplicate-actions@master
|
|
||||||
with:
|
|
||||||
paths: '["packages/squiggle-lang/**"]'
|
|
||||||
- id: skip_components_check
|
|
||||||
name: Check if the changes are about components src files
|
|
||||||
uses: fkirc/skip-duplicate-actions@master
|
|
||||||
with:
|
|
||||||
paths: '["packages/components/**"]'
|
|
||||||
- id: skip_website_check
|
|
||||||
name: Check if the changes are about website src files
|
|
||||||
uses: fkirc/skip-duplicate-actions@master
|
|
||||||
with:
|
|
||||||
paths: '["packages/website/**"]'
|
|
||||||
|
|
||||||
lang-build-test:
|
|
||||||
name: Language build and test
|
|
||||||
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@v2
|
|
||||||
- name: Install dependencies from monorepo level
|
|
||||||
run: cd ../../ && yarn
|
|
||||||
- name: Build rescript codebase
|
|
||||||
run: yarn build
|
|
||||||
- name: Run tests
|
|
||||||
run: yarn test
|
|
||||||
- name: Run webpack
|
|
||||||
run: yarn bundle
|
|
||||||
|
|
||||||
components-build-test:
|
|
||||||
name: Components build and test
|
|
||||||
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@v2
|
|
||||||
- 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-build:
|
|
||||||
name: Website build
|
|
||||||
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@v2
|
|
||||||
- name: Install dependencies from monorepo level
|
|
||||||
run: cd ../../ && yarn
|
|
||||||
- name: Build rescript in squiggle-lang
|
|
||||||
run: cd ../squiggle-lang && yarn build
|
|
||||||
- name: Build website assets
|
|
||||||
run: yarn build
|
|
155
.github/workflows/ci.yml
vendored
Normal file
155
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
name: Squiggle packages check
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- production
|
||||||
|
- staging
|
||||||
|
- develop
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- production
|
||||||
|
- staging
|
||||||
|
- develop
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pre_check:
|
||||||
|
name: Precheck for skipping redundant jobs
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
should_skip_lang: ${{ steps.skip_lang_check.outputs.should_skip }}
|
||||||
|
should_skip_components: ${{ steps.skip_components_check.outputs.should_skip }}
|
||||||
|
should_skip_website: ${{ steps.skip_website_check.outputs.should_skip }}
|
||||||
|
steps:
|
||||||
|
- id: skip_lang_check
|
||||||
|
name: Check if the changes are about squiggle-lang src files
|
||||||
|
uses: fkirc/skip-duplicate-actions@master
|
||||||
|
with:
|
||||||
|
paths: '["packages/squiggle-lang/**"]'
|
||||||
|
- id: skip_components_check
|
||||||
|
name: Check if the changes are about components src files
|
||||||
|
uses: fkirc/skip-duplicate-actions@master
|
||||||
|
with:
|
||||||
|
paths: '["packages/components/**"]'
|
||||||
|
- id: skip_website_check
|
||||||
|
name: Check if the changes are about website src files
|
||||||
|
uses: fkirc/skip-duplicate-actions@master
|
||||||
|
with:
|
||||||
|
paths: '["packages/website/**"]'
|
||||||
|
|
||||||
|
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@v2
|
||||||
|
- 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 .
|
||||||
|
|
||||||
|
lang-build-test-bundle:
|
||||||
|
name: Language build, test, and bundle
|
||||||
|
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@v2
|
||||||
|
- name: Install dependencies from monorepo level
|
||||||
|
run: cd ../../ && yarn
|
||||||
|
- name: Build rescript codebase
|
||||||
|
run: yarn build
|
||||||
|
- name: Run tests
|
||||||
|
run: yarn test
|
||||||
|
- name: Run webpack
|
||||||
|
run: yarn bundle
|
||||||
|
- name: Upload coverage report
|
||||||
|
run: yarn coverage: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@v2
|
||||||
|
- name: Check javascript, typescript, and markdown lint
|
||||||
|
uses: creyD/prettier_action@v4.2
|
||||||
|
with:
|
||||||
|
dry: true
|
||||||
|
prettier_options: --check .
|
||||||
|
|
||||||
|
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@v2
|
||||||
|
- 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@v2
|
||||||
|
- name: Check javascript, typescript, and markdown lint
|
||||||
|
uses: creyD/prettier_action@v4.2
|
||||||
|
with:
|
||||||
|
dry: true
|
||||||
|
prettier_options: --check .
|
||||||
|
|
||||||
|
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@v2
|
||||||
|
- name: Install dependencies from monorepo level
|
||||||
|
run: cd ../../ && yarn
|
||||||
|
- name: Build rescript in squiggle-lang
|
||||||
|
run: cd ../squiggle-lang && yarn build
|
||||||
|
- name: Build website assets
|
||||||
|
run: yarn build
|
66
.github/workflows/codeql-analysis.yml
vendored
66
.github/workflows/codeql-analysis.yml
vendored
|
@ -14,15 +14,19 @@ name: "CodeQL"
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- staging
|
- production
|
||||||
|
- staging
|
||||||
|
- develop
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- staging
|
- production
|
||||||
|
- staging
|
||||||
|
- develop
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '42 19 * * 0'
|
- cron: "42 19 * * 0"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
|
@ -36,39 +40,39 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
language: [ 'javascript' ]
|
language: ["javascript"]
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v1
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
# By default, queries listed here will override any specified in a config file.
|
# By default, queries listed here will override any specified in a config file.
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
# and modify them (or add more) to build your code if your project
|
# and modify them (or add more) to build your code if your project
|
||||||
# uses a compiled language
|
# uses a compiled language
|
||||||
|
|
||||||
#- run: |
|
#- run: |
|
||||||
# make bootstrap
|
# make bootstrap
|
||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v1
|
||||||
|
|
9
.prettierignore
Normal file
9
.prettierignore
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
.direnv
|
||||||
|
*.bs.js
|
||||||
|
*.gen.tsx
|
||||||
|
packages/*/dist
|
||||||
|
packages/components/storybook-static
|
||||||
|
node_modules
|
||||||
|
packages/*/node_modules
|
||||||
|
packages/website/.docusaurus
|
||||||
|
packages/squiggle-lang/lib
|
|
@ -21,6 +21,7 @@ Anyone (with a github account) can file an issue at any time. Please allow Quinn
|
||||||
# Project structure
|
# Project structure
|
||||||
|
|
||||||
Squiggle is a **monorepo** with four **packages**.
|
Squiggle is a **monorepo** with four **packages**.
|
||||||
|
|
||||||
- **components** is where we improve reactive interfacing with Squiggle
|
- **components** is where we improve reactive interfacing with Squiggle
|
||||||
- **playground** is the site `playground.squiggle-language.com`
|
- **playground** is the site `playground.squiggle-language.com`
|
||||||
- **squiggle-lang** is where the magic happens: probability distributions, the interpreter, etc.
|
- **squiggle-lang** is where the magic happens: probability distributions, the interpreter, etc.
|
||||||
|
@ -41,6 +42,7 @@ We aspire for `ci.yaml` and `README.md`s to be in one-to-one correspondence.
|
||||||
## If you're on NixOS
|
## If you're on NixOS
|
||||||
|
|
||||||
You'll need to run a command like this in order to get `yarn build` to run, especially in `packages/squiggle-lang`.
|
You'll need to run a command like this in order to get `yarn build` to run, especially in `packages/squiggle-lang`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
patchelf --set-interpreter $(patchelf --print-interpreter $(which mkdir)) ./node_modules/gentype/gentype.exe
|
patchelf --set-interpreter $(patchelf --print-interpreter $(which mkdir)) ./node_modules/gentype/gentype.exe
|
||||||
```
|
```
|
||||||
|
@ -124,3 +126,4 @@ We have some of this in the Reducer code, but generally discourage it.
|
||||||
- https://github.com/avohq/reasonml-code-style-guide
|
- https://github.com/avohq/reasonml-code-style-guide
|
||||||
- https://cs.brown.edu/courses/cs017/content/docs/reasonml-style.pdf
|
- https://cs.brown.edu/courses/cs017/content/docs/reasonml-style.pdf
|
||||||
- https://github.com/ostera/reason-design-patterns/
|
- https://github.com/ostera/reason-design-patterns/
|
||||||
|
|
||||||
|
|
29
README.md
29
README.md
|
@ -1,28 +1,34 @@
|
||||||
# Squiggle
|
# Squiggle
|
||||||
![Packages check](https://github.com/QURIresearch/squiggle/actions/workflows/ci.yaml/badge.svg)
|
|
||||||
|
[![Packages check](https://github.com/quantified-uncertainty/squiggle/actions/workflows/ci.yml/badge.svg)](https://github.com/quantified-uncertainty/squiggle/actions/workflows/ci.yml)
|
||||||
[![npm version](https://badge.fury.io/js/@quri%2Fsquiggle-lang.svg)](https://www.npmjs.com/package/@quri/squiggle-lang)
|
[![npm version](https://badge.fury.io/js/@quri%2Fsquiggle-lang.svg)](https://www.npmjs.com/package/@quri/squiggle-lang)
|
||||||
[![npm version](https://badge.fury.io/js/@quri%2Fsquiggle-components.svg)](https://www.npmjs.com/package/@quri/squiggle-components)
|
[![npm version](https://badge.fury.io/js/@quri%2Fsquiggle-components.svg)](https://www.npmjs.com/package/@quri/squiggle-components)
|
||||||
|
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/quantified-uncertainty/squiggle/blob/develop/LICENSE)
|
||||||
|
[![codecov](https://codecov.io/gh/quantified-uncertainty/squiggle/branch/develop/graph/badge.svg?token=QRLBL5CQ7C)](https://codecov.io/gh/quantified-uncertainty/squiggle)
|
||||||
|
|
||||||
This is an experimental DSL/language for making probabilistic estimates. The full story can be found [here](https://www.lesswrong.com/s/rDe8QE5NvXcZYzgZ3).
|
This is an experimental DSL/language for making probabilistic estimates. The full story can be found [here](https://www.lesswrong.com/s/rDe8QE5NvXcZYzgZ3).
|
||||||
|
|
||||||
## Our deployments
|
## Our deployments
|
||||||
|
|
||||||
- **website/docs prod**: https://squiggle-language.com
|
- **website/docs prod**: https://squiggle-language.com [![Netlify Status](https://api.netlify.com/api/v1/badges/2139af5c-671d-473d-a9f6-66c96077d8a1/deploy-status)](https://app.netlify.com/sites/squiggle-documentation/deploys)
|
||||||
- **website/docs staging**: https://staging--squiggle-documentation.netlify.app/
|
- **website/docs staging**: https://develop--squiggle-documentation.netlify.app/
|
||||||
- **old playground**: https://playground.squiggle-language.com
|
- **components storybook prod**: https://squiggle-components.netlify.app/ [![Netlify Status](https://api.netlify.com/api/v1/badges/b7f724aa-6b20-4d0e-bf86-3fcd1a3e9a70/deploy-status)](https://app.netlify.com/sites/squiggle-components/deploys)
|
||||||
|
- **components storybook staging**: https://develop--squiggle-components.netlify.app/
|
||||||
|
- **legacy (2020) playground**: https://playground.squiggle-language.com
|
||||||
|
|
||||||
## Packages
|
## Packages
|
||||||
|
|
||||||
This monorepo has several packages that can be used for various purposes. All
|
This monorepo has several packages that can be used for various purposes. All
|
||||||
the packages can be found in `packages`.
|
the packages can be found in `packages`.
|
||||||
|
|
||||||
- `@quri/squiggle-lang` in `packages/squiggle-lang` contains the core language, particularly
|
- `@quri/squiggle-lang` in `packages/squiggle-lang` contains the core language, particularly
|
||||||
an interface to parse squiggle expressions and return descriptions of distributions
|
an interface to parse squiggle expressions and return descriptions of distributions
|
||||||
or results.
|
or results.
|
||||||
- `@quri/squiggle-components` in `packages/components` contains React components that
|
- `@quri/squiggle-components` in `packages/components` contains React components that
|
||||||
can be passed squiggle strings as props, and return a presentation of the result
|
can be passed squiggle strings as props, and return a presentation of the result
|
||||||
of the calculation.
|
of the calculation.
|
||||||
- `@quri/squiggle-website` in `packages/website` The main descriptive website for squiggle,
|
- `@quri/squiggle-website` in `packages/website` The main descriptive website for squiggle,
|
||||||
it is hosted at `squiggle-language.com`.
|
it is hosted at `squiggle-language.com`.
|
||||||
|
|
||||||
The playground depends on the components library which then depends on the language. This means that if you wish to work on the components library, you will need to build (no need to bundle) the language, and as of this writing playground doesn't really work.
|
The playground depends on the components library which then depends on the language. This means that if you wish to work on the components library, you will need to build (no need to bundle) the language, and as of this writing playground doesn't really work.
|
||||||
|
|
||||||
|
@ -30,7 +36,7 @@ The playground depends on the components library which then depends on the langu
|
||||||
|
|
||||||
For any project in the repo, begin by running `yarn` in the top level (TODO: is this true?)
|
For any project in the repo, begin by running `yarn` in the top level (TODO: is this true?)
|
||||||
|
|
||||||
``` sh
|
```sh
|
||||||
yarn
|
yarn
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -40,7 +46,7 @@ See `packages/*/README.md` to work with whatever project you're interested in.
|
||||||
|
|
||||||
If you have `nix` installed with `flakes` enabled, you can build a `codium` in this repo for `rescript` development, if you don't want to pollute your machine's global editor with another mode/extension.
|
If you have `nix` installed with `flakes` enabled, you can build a `codium` in this repo for `rescript` development, if you don't want to pollute your machine's global editor with another mode/extension.
|
||||||
|
|
||||||
``` sh
|
```sh
|
||||||
nix develop
|
nix develop
|
||||||
codium
|
codium
|
||||||
```
|
```
|
||||||
|
@ -48,4 +54,5 @@ codium
|
||||||
The `nix develop` shell also provides `yarn`.
|
The `nix develop` shell also provides `yarn`.
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
See `CONTRIBUTING.md`.
|
See `CONTRIBUTING.md`.
|
||||||
|
|
|
@ -4,11 +4,15 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"nodeclean": "rm -r node_modules && rm -r packages/*/node_modules"
|
"nodeclean": "rm -r node_modules && rm -r packages/*/node_modules"
|
||||||
},
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"prettier": "^2.6.2"
|
||||||
|
},
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@types/react": "^17.0.43"
|
"@types/react": "^18.0.1",
|
||||||
|
"react": "^18.0.0"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@1.22.17"
|
"packageManager": "yarn@1.22.17"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
dist
|
|
||||||
build
|
|
||||||
node_modules
|
|
||||||
storybook-static
|
|
||||||
.storybook
|
|
|
@ -1,31 +1,37 @@
|
||||||
//const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
//const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
||||||
const custom = require('../webpack.config.js');
|
const custom = require("../webpack.config.js");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
webpackFinal: async (config) => {
|
webpackFinal: async (config) => {
|
||||||
config.resolve.alias = custom.resolve.alias;
|
config.resolve.alias = custom.resolve.alias;
|
||||||
return { ...config, module: { ...config.module, rules: config.module.rules.concat(custom.module.rules.filter(x => x.loader === "ts-loader")) } };
|
return {
|
||||||
|
...config,
|
||||||
|
module: {
|
||||||
|
...config.module,
|
||||||
|
rules: config.module.rules.concat(
|
||||||
|
custom.module.rules.filter((x) => x.loader === "ts-loader")
|
||||||
|
),
|
||||||
|
},
|
||||||
|
};
|
||||||
},
|
},
|
||||||
"stories": [
|
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
||||||
"../src/**/*.stories.mdx",
|
addons: [
|
||||||
"../src/**/*.stories.@(js|jsx|ts|tsx)"
|
|
||||||
],
|
|
||||||
"addons": [
|
|
||||||
"@storybook/addon-links",
|
"@storybook/addon-links",
|
||||||
"@storybook/addon-essentials",
|
"@storybook/addon-essentials",
|
||||||
"@storybook/preset-create-react-app"
|
"@storybook/preset-create-react-app",
|
||||||
],
|
],
|
||||||
"framework": "@storybook/react",
|
framework: "@storybook/react",
|
||||||
"core": {
|
core: {
|
||||||
"builder": "webpack5"
|
builder: "webpack5",
|
||||||
},
|
},
|
||||||
typescript: {
|
typescript: {
|
||||||
check: false,
|
check: false,
|
||||||
checkOptions: {},
|
checkOptions: {},
|
||||||
reactDocgen: 'react-docgen-typescript',
|
reactDocgen: "react-docgen-typescript",
|
||||||
reactDocgenTypescriptOptions: {
|
reactDocgenTypescriptOptions: {
|
||||||
shouldExtractLiteralValuesFromEnum: true,
|
shouldExtractLiteralValuesFromEnum: true,
|
||||||
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
|
propFilter: (prop) =>
|
||||||
|
prop.parent ? !/node_modules/.test(prop.parent.fileName) : true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
|
@ -6,4 +6,4 @@ export const parameters = {
|
||||||
date: /Date$/,
|
date: /Date$/,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@quri/squiggle-lang": "0.2.2",
|
"@quri/squiggle-lang": "0.2.2",
|
||||||
"@testing-library/jest-dom": "^5.16.4",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
"@testing-library/react": "^13.0.0",
|
"@testing-library/react": "^13.0.1",
|
||||||
"@testing-library/user-event": "^14.0.4",
|
"@testing-library/user-event": "^14.0.4",
|
||||||
"@types/jest": "^27.4.0",
|
"@types/jest": "^27.4.0",
|
||||||
"@types/lodash": "^4.14.181",
|
"@types/lodash": "^4.14.181",
|
||||||
|
@ -15,10 +15,10 @@
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"react": "^18.0.0",
|
"react": "^18.0.0",
|
||||||
|
"react-ace": "9.5.0",
|
||||||
"react-dom": "^18.0.0",
|
"react-dom": "^18.0.0",
|
||||||
"react-scripts": "5.0.0",
|
"react-scripts": "5.0.0",
|
||||||
"react-vega": "^7.5.0",
|
"react-vega": "^7.5.0",
|
||||||
"react-ace": "9.5.0",
|
|
||||||
"styled-components": "^5.3.5",
|
"styled-components": "^5.3.5",
|
||||||
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
||||||
"typescript": "^4.6.3",
|
"typescript": "^4.6.3",
|
||||||
|
@ -32,7 +32,9 @@
|
||||||
"start": "cross-env REACT_APP_FAST_REFRESH=false && start-storybook -p 6006 -s public",
|
"start": "cross-env REACT_APP_FAST_REFRESH=false && start-storybook -p 6006 -s public",
|
||||||
"build": "tsc -b && build-storybook -s public",
|
"build": "tsc -b && build-storybook -s public",
|
||||||
"bundle": "webpack",
|
"bundle": "webpack",
|
||||||
"all": "yarn bundle && yarn build"
|
"all": "yarn bundle && yarn build",
|
||||||
|
"lint": "prettier --check .",
|
||||||
|
"format": "prettier --write ."
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
|
@ -63,9 +65,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/styled-components": "^5.1.24",
|
|
||||||
"css-loader": "^6.7.1",
|
|
||||||
"style-loader": "^3.3.1",
|
|
||||||
"@babel/plugin-proposal-private-property-in-object": "^7.16.7",
|
"@babel/plugin-proposal-private-property-in-object": "^7.16.7",
|
||||||
"@storybook/addon-actions": "^6.4.20",
|
"@storybook/addon-actions": "^6.4.20",
|
||||||
"@storybook/addon-essentials": "^6.4.20",
|
"@storybook/addon-essentials": "^6.4.20",
|
||||||
|
@ -75,9 +74,10 @@
|
||||||
"@storybook/node-logger": "^6.4.20",
|
"@storybook/node-logger": "^6.4.20",
|
||||||
"@storybook/preset-create-react-app": "^4.1.0",
|
"@storybook/preset-create-react-app": "^4.1.0",
|
||||||
"@storybook/react": "^6.4.20",
|
"@storybook/react": "^6.4.20",
|
||||||
|
"@types/styled-components": "^5.1.24",
|
||||||
"@types/webpack": "^4.41.32",
|
"@types/webpack": "^4.41.32",
|
||||||
"prettier": "^2.6.2",
|
|
||||||
"react-codejar": "^1.1.2",
|
"react-codejar": "^1.1.2",
|
||||||
|
"style-loader": "^3.3.1",
|
||||||
"ts-loader": "^9.2.8",
|
"ts-loader": "^9.2.8",
|
||||||
"webpack": "^5.72.0",
|
"webpack": "^5.72.0",
|
||||||
"webpack-cli": "^4.9.2",
|
"webpack-cli": "^4.9.2",
|
||||||
|
|
|
@ -1,124 +0,0 @@
|
||||||
import * as React from "react";
|
|
||||||
import _ from "lodash";
|
|
||||||
import type { Spec } from "vega";
|
|
||||||
import type {
|
|
||||||
DistPlus,
|
|
||||||
} from "@quri/squiggle-lang";
|
|
||||||
import { createClassFromSpec } from "react-vega";
|
|
||||||
import * as chartSpecification from "../vega-specs/spec-distributions.json";
|
|
||||||
|
|
||||||
let SquiggleVegaChart = createClassFromSpec({
|
|
||||||
spec: chartSpecification as Spec,
|
|
||||||
});
|
|
||||||
|
|
||||||
export const DistPlusChart: React.FC<{
|
|
||||||
distPlus: DistPlus;
|
|
||||||
width: number;
|
|
||||||
height: number;
|
|
||||||
}> = ({ distPlus, width, height }) => {
|
|
||||||
let shape = distPlus.pointSetDist;
|
|
||||||
if (shape.tag === "Continuous") {
|
|
||||||
let xyShape = shape.value.xyShape;
|
|
||||||
let totalY = xyShape.ys.reduce((a, b) => a + b);
|
|
||||||
let total = 0;
|
|
||||||
let cdf = xyShape.ys.map((y) => {
|
|
||||||
total += y;
|
|
||||||
return total / totalY;
|
|
||||||
});
|
|
||||||
let values = _.zip(cdf, xyShape.xs, xyShape.ys).map(([c, x, y]) => ({
|
|
||||||
cdf: (c * 100).toFixed(2) + "%",
|
|
||||||
x: x,
|
|
||||||
y: y,
|
|
||||||
}));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SquiggleVegaChart
|
|
||||||
width={width}
|
|
||||||
height={height}
|
|
||||||
data={{ con: values }}
|
|
||||||
actions={false}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else if (shape.tag === "Discrete") {
|
|
||||||
let xyShape = shape.value.xyShape;
|
|
||||||
let totalY = xyShape.ys.reduce((a, b) => a + b);
|
|
||||||
let total = 0;
|
|
||||||
let cdf = xyShape.ys.map((y) => {
|
|
||||||
total += y;
|
|
||||||
return total / totalY;
|
|
||||||
});
|
|
||||||
let values = _.zip(cdf, xyShape.xs, xyShape.ys).map(([c, x, y]) => ({
|
|
||||||
cdf: (c * 100).toFixed(2) + "%",
|
|
||||||
x: x,
|
|
||||||
y: y,
|
|
||||||
}));
|
|
||||||
|
|
||||||
return <SquiggleVegaChart data={{ dis: values }} actions={false} />;
|
|
||||||
} else if (shape.tag === "Mixed") {
|
|
||||||
let discreteShape = shape.value.discrete.xyShape;
|
|
||||||
let totalDiscrete = discreteShape.ys.reduce((a, b) => a + b);
|
|
||||||
|
|
||||||
let discretePoints = _.zip(discreteShape.xs, discreteShape.ys);
|
|
||||||
let continuousShape = shape.value.continuous.xyShape;
|
|
||||||
let continuousPoints = _.zip(continuousShape.xs, continuousShape.ys);
|
|
||||||
|
|
||||||
interface labeledPoint {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
type: "discrete" | "continuous";
|
|
||||||
}
|
|
||||||
|
|
||||||
let markedDisPoints: labeledPoint[] = discretePoints.map(([x, y]) => ({
|
|
||||||
x: x,
|
|
||||||
y: y,
|
|
||||||
type: "discrete",
|
|
||||||
}));
|
|
||||||
let markedConPoints: labeledPoint[] = continuousPoints.map(([x, y]) => ({
|
|
||||||
x: x,
|
|
||||||
y: y,
|
|
||||||
type: "continuous",
|
|
||||||
}));
|
|
||||||
|
|
||||||
let sortedPoints = _.sortBy(markedDisPoints.concat(markedConPoints), "x");
|
|
||||||
|
|
||||||
let totalContinuous = 1 - totalDiscrete;
|
|
||||||
let totalY = continuousShape.ys.reduce((a: number, b: number) => a + b);
|
|
||||||
|
|
||||||
let total = 0;
|
|
||||||
let cdf = sortedPoints.map((point: labeledPoint) => {
|
|
||||||
if (point.type === "discrete") {
|
|
||||||
total += point.y;
|
|
||||||
return total;
|
|
||||||
} else if (point.type === "continuous") {
|
|
||||||
total += (point.y / totalY) * totalContinuous;
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
interface cdfLabeledPoint {
|
|
||||||
cdf: string;
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
type: "discrete" | "continuous";
|
|
||||||
}
|
|
||||||
let cdfLabeledPoint: cdfLabeledPoint[] = _.zipWith(
|
|
||||||
cdf,
|
|
||||||
sortedPoints,
|
|
||||||
(c: number, point: labeledPoint) => ({
|
|
||||||
...point,
|
|
||||||
cdf: (c * 100).toFixed(2) + "%",
|
|
||||||
})
|
|
||||||
);
|
|
||||||
let continuousValues = cdfLabeledPoint.filter(
|
|
||||||
(x) => x.type === "continuous"
|
|
||||||
);
|
|
||||||
let discreteValues = cdfLabeledPoint.filter((x) => x.type === "discrete");
|
|
||||||
|
|
||||||
return (
|
|
||||||
<SquiggleVegaChart
|
|
||||||
data={{ con: continuousValues, dis: discreteValues }}
|
|
||||||
actions={false}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
42
packages/components/src/components/DistributionChart.tsx
Normal file
42
packages/components/src/components/DistributionChart.tsx
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import * as React from "react";
|
||||||
|
import _ from "lodash";
|
||||||
|
import type { Spec } from "vega";
|
||||||
|
import type { Distribution } from "@quri/squiggle-lang";
|
||||||
|
import { distributionErrorToString } from "@quri/squiggle-lang";
|
||||||
|
import { createClassFromSpec } from "react-vega";
|
||||||
|
import * as chartSpecification from "../vega-specs/spec-distributions.json";
|
||||||
|
import { ErrorBox } from "./ErrorBox";
|
||||||
|
|
||||||
|
let SquiggleVegaChart = createClassFromSpec({
|
||||||
|
spec: chartSpecification as Spec,
|
||||||
|
});
|
||||||
|
|
||||||
|
type DistributionChartProps = {
|
||||||
|
distribution: Distribution;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DistributionChart: React.FC<DistributionChartProps> = ({
|
||||||
|
distribution,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
}: DistributionChartProps) => {
|
||||||
|
let shape = distribution.pointSet();
|
||||||
|
if (shape.tag === "Ok") {
|
||||||
|
return (
|
||||||
|
<SquiggleVegaChart
|
||||||
|
data={{ con: shape.value.continuous, dis: shape.value.discrete }}
|
||||||
|
width={width}
|
||||||
|
height={height}
|
||||||
|
actions={false}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<ErrorBox heading="Distribution Error">
|
||||||
|
{distributionErrorToString(shape.value)}
|
||||||
|
</ErrorBox>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
|
@ -7,10 +7,10 @@ const ShowError = styled.div`
|
||||||
padding: 0.4em 0.8em;
|
padding: 0.4em 0.8em;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const Error: React.FC<{ heading: string; children: React.ReactNode }> = ({
|
export const ErrorBox: React.FC<{
|
||||||
heading = "Error",
|
heading: string;
|
||||||
children,
|
children: React.ReactNode;
|
||||||
}) => {
|
}> = ({ heading = "Error", children }) => {
|
||||||
return (
|
return (
|
||||||
<ShowError>
|
<ShowError>
|
||||||
<h3>{heading}</h3>
|
<h3>{heading}</h3>
|
|
@ -1,88 +1,101 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import type { Spec } from "vega";
|
import type { Spec } from "vega";
|
||||||
import type { DistPlus } from "@quri/squiggle-lang";
|
import type { Distribution, errorValue, result } from "@quri/squiggle-lang";
|
||||||
import { createClassFromSpec } from "react-vega";
|
import { createClassFromSpec } from "react-vega";
|
||||||
import * as percentilesSpec from "../vega-specs/spec-percentiles.json";
|
import * as percentilesSpec from "../vega-specs/spec-percentiles.json";
|
||||||
import { DistPlusChart } from "./DistPlusChart";
|
import { DistributionChart } from "./DistributionChart";
|
||||||
import { Error } from "./Error";
|
import { ErrorBox } from "./ErrorBox";
|
||||||
|
|
||||||
let SquigglePercentilesChart = createClassFromSpec({
|
let SquigglePercentilesChart = createClassFromSpec({
|
||||||
spec: percentilesSpec as Spec,
|
spec: percentilesSpec as Spec,
|
||||||
});
|
});
|
||||||
|
|
||||||
type distPlusFn = (
|
type distPlusFn = (a: number) => result<Distribution, errorValue>;
|
||||||
a: number
|
|
||||||
) => { tag: "Ok"; value: DistPlus } | { tag: "Error"; value: string };
|
|
||||||
|
|
||||||
const _rangeByCount = (start, stop, count) => {
|
const _rangeByCount = (start: number, stop: number, count: number) => {
|
||||||
const step = (stop - start) / (count - 1);
|
const step = (stop - start) / (count - 1);
|
||||||
const items = _.range(start, stop, step);
|
const items = _.range(start, stop, step);
|
||||||
const result = items.concat([stop]);
|
const result = items.concat([stop]);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function unwrap<a, b>(x: result<a, b>): a {
|
||||||
|
if (x.tag === "Ok") {
|
||||||
|
return x.value;
|
||||||
|
} else {
|
||||||
|
throw Error("FAILURE TO UNWRAP");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapFilter<a, b>(xs: a[], f: (x: a) => b | undefined): b[] {
|
||||||
|
let initial: b[] = [];
|
||||||
|
return xs.reduce((previous, current) => {
|
||||||
|
let value: b | undefined = f(current);
|
||||||
|
if (value !== undefined) {
|
||||||
|
return previous.concat([value]);
|
||||||
|
} else {
|
||||||
|
return previous;
|
||||||
|
}
|
||||||
|
}, initial);
|
||||||
|
}
|
||||||
|
|
||||||
export const FunctionChart: React.FC<{
|
export const FunctionChart: React.FC<{
|
||||||
distPlusFn: distPlusFn;
|
distPlusFn: distPlusFn;
|
||||||
diagramStart: number;
|
diagramStart: number;
|
||||||
diagramStop: number;
|
diagramStop: number;
|
||||||
diagramCount: number;
|
diagramCount: number;
|
||||||
}> = ({ distPlusFn, diagramStart, diagramStop, diagramCount }) => {
|
}> = ({ distPlusFn, diagramStart, diagramStop, diagramCount }) => {
|
||||||
let [mouseOverlay, setMouseOverlay] = React.useState(NaN);
|
let [mouseOverlay, setMouseOverlay] = React.useState(0);
|
||||||
function handleHover(...args) {
|
function handleHover(...args) {
|
||||||
setMouseOverlay(args[1]);
|
setMouseOverlay(args[1]);
|
||||||
}
|
}
|
||||||
function handleOut(...args) {
|
function handleOut() {
|
||||||
setMouseOverlay(NaN);
|
setMouseOverlay(NaN);
|
||||||
}
|
}
|
||||||
const signalListeners = { mousemove: handleHover, mouseout: handleOut };
|
const signalListeners = { mousemove: handleHover, mouseout: handleOut };
|
||||||
let percentileArray = [
|
|
||||||
0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99,
|
|
||||||
];
|
|
||||||
let mouseItem = distPlusFn(mouseOverlay);
|
let mouseItem = distPlusFn(mouseOverlay);
|
||||||
let showChart =
|
let showChart =
|
||||||
mouseItem.tag === "Ok" ? (
|
mouseItem.tag === "Ok" ? (
|
||||||
<DistPlusChart distPlus={mouseItem.value} width={400} height={140} />
|
<DistributionChart
|
||||||
|
distribution={mouseItem.value}
|
||||||
|
width={400}
|
||||||
|
height={140}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
);
|
);
|
||||||
let data1 = _rangeByCount(diagramStart, diagramStop, diagramCount);
|
let data1 = _rangeByCount(diagramStart, diagramStop, diagramCount);
|
||||||
let valueData = data1
|
let valueData = mapFilter(data1, (x) => {
|
||||||
.map((x) => {
|
let result = distPlusFn(x);
|
||||||
let result = distPlusFn(x);
|
if (result.tag === "Ok") {
|
||||||
if (result.tag === "Ok") {
|
return { x: x, value: result.value };
|
||||||
return { x: x, value: result.value };
|
}
|
||||||
} else return null;
|
}).map(({ x, value }) => {
|
||||||
})
|
return {
|
||||||
.filter((x) => x !== null)
|
x: x,
|
||||||
.map(({ x, value }) => {
|
p1: unwrap(value.inv(0.01)),
|
||||||
let percentiles = getPercentiles(percentileArray, value);
|
p5: unwrap(value.inv(0.05)),
|
||||||
return {
|
p10: unwrap(value.inv(0.12)),
|
||||||
x: x,
|
p20: unwrap(value.inv(0.2)),
|
||||||
p1: percentiles[0],
|
p30: unwrap(value.inv(0.3)),
|
||||||
p5: percentiles[1],
|
p40: unwrap(value.inv(0.4)),
|
||||||
p10: percentiles[2],
|
p50: unwrap(value.inv(0.5)),
|
||||||
p20: percentiles[3],
|
p60: unwrap(value.inv(0.6)),
|
||||||
p30: percentiles[4],
|
p70: unwrap(value.inv(0.7)),
|
||||||
p40: percentiles[5],
|
p80: unwrap(value.inv(0.8)),
|
||||||
p50: percentiles[6],
|
p90: unwrap(value.inv(0.9)),
|
||||||
p60: percentiles[7],
|
p95: unwrap(value.inv(0.95)),
|
||||||
p70: percentiles[8],
|
p99: unwrap(value.inv(0.99)),
|
||||||
p80: percentiles[9],
|
};
|
||||||
p90: percentiles[10],
|
});
|
||||||
p95: percentiles[11],
|
|
||||||
p99: percentiles[12],
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
let errorData = data1
|
let errorData = mapFilter(data1, (x) => {
|
||||||
.map((x) => {
|
let result = distPlusFn(x);
|
||||||
let result = distPlusFn(x);
|
if (result.tag === "Error") {
|
||||||
if (result.tag === "Error") {
|
return { x: x, error: result.value };
|
||||||
return { x: x, error: result.value };
|
}
|
||||||
} else return null;
|
});
|
||||||
})
|
|
||||||
.filter((x) => x !== null);
|
|
||||||
let error2 = _.groupBy(errorData, (x) => x.error);
|
let error2 = _.groupBy(errorData, (x) => x.error);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -93,96 +106,10 @@ export const FunctionChart: React.FC<{
|
||||||
/>
|
/>
|
||||||
{showChart}
|
{showChart}
|
||||||
{_.keysIn(error2).map((k) => (
|
{_.keysIn(error2).map((k) => (
|
||||||
<Error heading={k}>
|
<ErrorBox heading={k}>
|
||||||
{`Values: [${error2[k].map((r) => r.x.toFixed(2)).join(",")}]`}
|
{`Values: [${error2[k].map((r) => r.x.toFixed(2)).join(",")}]`}
|
||||||
</Error>
|
</ErrorBox>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getPercentiles(percentiles: number[], t: DistPlus) {
|
|
||||||
if (t.pointSetDist.tag === "Discrete") {
|
|
||||||
let total = 0;
|
|
||||||
let maxX = _.max(t.pointSetDist.value.xyShape.xs);
|
|
||||||
let bounds = percentiles.map((_) => maxX);
|
|
||||||
_.zipWith(
|
|
||||||
t.pointSetDist.value.xyShape.xs,
|
|
||||||
t.pointSetDist.value.xyShape.ys,
|
|
||||||
(x, y) => {
|
|
||||||
total += y;
|
|
||||||
percentiles.forEach((v, i) => {
|
|
||||||
if (total > v && bounds[i] === maxX) {
|
|
||||||
bounds[i] = x;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return bounds;
|
|
||||||
} else if (t.pointSetDist.tag === "Continuous") {
|
|
||||||
let total = 0;
|
|
||||||
let maxX = _.max(t.pointSetDist.value.xyShape.xs);
|
|
||||||
let totalY = _.sum(t.pointSetDist.value.xyShape.ys);
|
|
||||||
let bounds = percentiles.map((_) => maxX);
|
|
||||||
_.zipWith(
|
|
||||||
t.pointSetDist.value.xyShape.xs,
|
|
||||||
t.pointSetDist.value.xyShape.ys,
|
|
||||||
(x, y) => {
|
|
||||||
total += y / totalY;
|
|
||||||
percentiles.forEach((v, i) => {
|
|
||||||
if (total > v && bounds[i] === maxX) {
|
|
||||||
bounds[i] = x;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return bounds;
|
|
||||||
} else if (t.pointSetDist.tag === "Mixed") {
|
|
||||||
let discreteShape = t.pointSetDist.value.discrete.xyShape;
|
|
||||||
let totalDiscrete = discreteShape.ys.reduce((a, b) => a + b);
|
|
||||||
|
|
||||||
let discretePoints = _.zip(discreteShape.xs, discreteShape.ys);
|
|
||||||
let continuousShape = t.pointSetDist.value.continuous.xyShape;
|
|
||||||
let continuousPoints = _.zip(continuousShape.xs, continuousShape.ys);
|
|
||||||
|
|
||||||
interface labeledPoint {
|
|
||||||
x: number;
|
|
||||||
y: number;
|
|
||||||
type: "discrete" | "continuous";
|
|
||||||
}
|
|
||||||
|
|
||||||
let markedDisPoints: labeledPoint[] = discretePoints.map(([x, y]) => ({
|
|
||||||
x: x,
|
|
||||||
y: y,
|
|
||||||
type: "discrete",
|
|
||||||
}));
|
|
||||||
let markedConPoints: labeledPoint[] = continuousPoints.map(([x, y]) => ({
|
|
||||||
x: x,
|
|
||||||
y: y,
|
|
||||||
type: "continuous",
|
|
||||||
}));
|
|
||||||
|
|
||||||
let sortedPoints = _.sortBy(markedDisPoints.concat(markedConPoints), "x");
|
|
||||||
|
|
||||||
let totalContinuous = 1 - totalDiscrete;
|
|
||||||
let totalY = continuousShape.ys.reduce((a: number, b: number) => a + b);
|
|
||||||
|
|
||||||
let total = 0;
|
|
||||||
let maxX = _.max(sortedPoints.map((x) => x.x));
|
|
||||||
let bounds = percentiles.map((_) => maxX);
|
|
||||||
sortedPoints.map((point: labeledPoint) => {
|
|
||||||
if (point.type === "discrete") {
|
|
||||||
total += point.y;
|
|
||||||
} else if (point.type === "continuous") {
|
|
||||||
total += (point.y / totalY) * totalContinuous;
|
|
||||||
}
|
|
||||||
percentiles.forEach((v, i) => {
|
|
||||||
if (total > v && bounds[i] === maxX) {
|
|
||||||
bounds[i] = total;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return total;
|
|
||||||
});
|
|
||||||
return bounds;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,97 +2,97 @@ import * as React from "react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
|
|
||||||
const orderOfMagnitudeNum = (n: number) => {
|
const orderOfMagnitudeNum = (n: number) => {
|
||||||
return Math.pow(10, n);
|
return Math.pow(10, n);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 105 -> 3
|
// 105 -> 3
|
||||||
const orderOfMagnitude = (n: number) => {
|
const orderOfMagnitude = (n: number) => {
|
||||||
return Math.floor(Math.log(n) / Math.LN10 + 0.000000001);
|
return Math.floor(Math.log(n) / Math.LN10 + 0.000000001);
|
||||||
};
|
};
|
||||||
|
|
||||||
function withXSigFigs(number: number, sigFigs: number) {
|
function withXSigFigs(number: number, sigFigs: number) {
|
||||||
const withPrecision = number.toPrecision(sigFigs);
|
const withPrecision = number.toPrecision(sigFigs);
|
||||||
const formatted = Number(withPrecision);
|
const formatted = Number(withPrecision);
|
||||||
return `${formatted}`;
|
return `${formatted}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
class NumberShowerBuilder {
|
class NumberShowerBuilder {
|
||||||
number: number;
|
number: number;
|
||||||
precision: number;
|
precision: number;
|
||||||
|
|
||||||
constructor(number: number, precision = 2) {
|
constructor(number: number, precision = 2) {
|
||||||
this.number = number;
|
this.number = number;
|
||||||
this.precision = precision;
|
this.precision = precision;
|
||||||
|
}
|
||||||
|
|
||||||
|
convert() {
|
||||||
|
const number = Math.abs(this.number);
|
||||||
|
const response = this.evaluate(number);
|
||||||
|
if (this.number < 0) {
|
||||||
|
response.value = "-" + response.value;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
metricSystem(number: number, order: number) {
|
||||||
|
const newNumber = number / orderOfMagnitudeNum(order);
|
||||||
|
const precision = this.precision;
|
||||||
|
return `${withXSigFigs(newNumber, precision)}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
evaluate(number: number) {
|
||||||
|
if (number === 0) {
|
||||||
|
return { value: this.metricSystem(0, 0) };
|
||||||
}
|
}
|
||||||
|
|
||||||
convert() {
|
const order = orderOfMagnitude(number);
|
||||||
const number = Math.abs(this.number);
|
if (order < -2) {
|
||||||
const response = this.evaluate(number);
|
return { value: this.metricSystem(number, order), power: order };
|
||||||
if (this.number < 0) {
|
} else if (order < 4) {
|
||||||
response.value = "-" + response.value;
|
return { value: this.metricSystem(number, 0) };
|
||||||
}
|
} else if (order < 6) {
|
||||||
return response;
|
return { value: this.metricSystem(number, 3), symbol: "K" };
|
||||||
}
|
} else if (order < 9) {
|
||||||
|
return { value: this.metricSystem(number, 6), symbol: "M" };
|
||||||
metricSystem(number: number, order: number) {
|
} else if (order < 12) {
|
||||||
const newNumber = number / orderOfMagnitudeNum(order);
|
return { value: this.metricSystem(number, 9), symbol: "B" };
|
||||||
const precision = this.precision;
|
} else if (order < 15) {
|
||||||
return `${withXSigFigs(newNumber, precision)}`;
|
return { value: this.metricSystem(number, 12), symbol: "T" };
|
||||||
}
|
} else {
|
||||||
|
return { value: this.metricSystem(number, order), power: order };
|
||||||
evaluate(number: number) {
|
|
||||||
if (number === 0) {
|
|
||||||
return { value: this.metricSystem(0, 0) };
|
|
||||||
}
|
|
||||||
|
|
||||||
const order = orderOfMagnitude(number);
|
|
||||||
if (order < -2) {
|
|
||||||
return { value: this.metricSystem(number, order), power: order };
|
|
||||||
} else if (order < 4) {
|
|
||||||
return { value: this.metricSystem(number, 0) };
|
|
||||||
} else if (order < 6) {
|
|
||||||
return { value: this.metricSystem(number, 3), symbol: "K" };
|
|
||||||
} else if (order < 9) {
|
|
||||||
return { value: this.metricSystem(number, 6), symbol: "M" };
|
|
||||||
} else if (order < 12) {
|
|
||||||
return { value: this.metricSystem(number, 9), symbol: "B" };
|
|
||||||
} else if (order < 15) {
|
|
||||||
return { value: this.metricSystem(number, 12), symbol: "T" };
|
|
||||||
} else {
|
|
||||||
return { value: this.metricSystem(number, order), power: order };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function numberShow(number: number, precision = 2) {
|
export function numberShow(number: number, precision = 2) {
|
||||||
const ns = new NumberShowerBuilder(number, precision);
|
const ns = new NumberShowerBuilder(number, precision);
|
||||||
return ns.convert();
|
return ns.convert();
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NumberShowerProps {
|
export interface NumberShowerProps {
|
||||||
number: number;
|
number: number;
|
||||||
precision?: number
|
precision?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export let NumberShower: React.FC<NumberShowerProps> = ({
|
export let NumberShower: React.FC<NumberShowerProps> = ({
|
||||||
number,
|
number,
|
||||||
precision = 2
|
precision = 2,
|
||||||
}: NumberShowerProps) => {
|
}: NumberShowerProps) => {
|
||||||
let numberWithPresentation = numberShow(number, precision);
|
let numberWithPresentation = numberShow(number, precision);
|
||||||
return (
|
return (
|
||||||
|
<span>
|
||||||
|
{numberWithPresentation.value}
|
||||||
|
{numberWithPresentation.symbol}
|
||||||
|
{numberWithPresentation.power ? (
|
||||||
<span>
|
<span>
|
||||||
{numberWithPresentation.value}
|
{"\u00b710"}
|
||||||
{numberWithPresentation.symbol}
|
<span style={{ fontSize: "0.6em", verticalAlign: "super" }}>
|
||||||
{numberWithPresentation.power ? (
|
{numberWithPresentation.power}
|
||||||
<span>
|
</span>
|
||||||
{"\u00b710"}
|
|
||||||
<span style={{ fontSize: "0.6em", verticalAlign: "super" }}>
|
|
||||||
{numberWithPresentation.power}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
)}
|
|
||||||
</span>
|
</span>
|
||||||
);
|
) : (
|
||||||
}
|
<></>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
|
@ -1,15 +1,10 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { run } from "@quri/squiggle-lang";
|
import { run, errorValueToString } from "@quri/squiggle-lang";
|
||||||
import type {
|
import type { samplingParams, exportEnv } from "@quri/squiggle-lang";
|
||||||
SamplingInputs,
|
|
||||||
exportEnv,
|
|
||||||
exportDistribution,
|
|
||||||
} from "@quri/squiggle-lang";
|
|
||||||
import { NumberShower } from "./NumberShower";
|
import { NumberShower } from "./NumberShower";
|
||||||
import { DistPlusChart } from "./DistPlusChart";
|
import { DistributionChart } from "./DistributionChart";
|
||||||
import { FunctionChart } from "./FunctionChart";
|
import { ErrorBox } from "./ErrorBox";
|
||||||
import { Error } from "./Error";
|
|
||||||
|
|
||||||
export interface SquiggleChartProps {
|
export interface SquiggleChartProps {
|
||||||
/** The input string for squiggle */
|
/** The input string for squiggle */
|
||||||
|
@ -39,53 +34,43 @@ export const SquiggleChart: React.FC<SquiggleChartProps> = ({
|
||||||
squiggleString = "",
|
squiggleString = "",
|
||||||
sampleCount = 1000,
|
sampleCount = 1000,
|
||||||
outputXYPoints = 1000,
|
outputXYPoints = 1000,
|
||||||
kernelWidth,
|
|
||||||
pointDistLength = 1000,
|
|
||||||
diagramStart = 0,
|
|
||||||
diagramStop = 10,
|
|
||||||
diagramCount = 20,
|
|
||||||
environment = [],
|
environment = [],
|
||||||
onEnvChange = () => {},
|
onEnvChange = () => {},
|
||||||
width = 500,
|
width = 500,
|
||||||
height = 60,
|
height = 60,
|
||||||
}: SquiggleChartProps) => {
|
}: SquiggleChartProps) => {
|
||||||
let samplingInputs: SamplingInputs = {
|
let samplingInputs: samplingParams = {
|
||||||
sampleCount: sampleCount,
|
sampleCount: sampleCount,
|
||||||
outputXYPoints: outputXYPoints,
|
xyPointLength: outputXYPoints,
|
||||||
kernelWidth: kernelWidth,
|
|
||||||
pointDistLength: pointDistLength,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = run(squiggleString, samplingInputs, environment);
|
let expressionResult = run(squiggleString, samplingInputs, environment);
|
||||||
if (result.tag === "Ok") {
|
if (expressionResult.tag === "Ok") {
|
||||||
let environment = result.value.environment;
|
|
||||||
let exports = result.value.exports;
|
|
||||||
onEnvChange(environment);
|
onEnvChange(environment);
|
||||||
let chartResults = exports.map((chartResult: exportDistribution) => {
|
let expression = expressionResult.value;
|
||||||
if (chartResult["NAME"] === "Float") {
|
if (expression.tag === "number") {
|
||||||
return <NumberShower precision={3} number={chartResult["VAL"]} />;
|
return <NumberShower precision={3} number={expression.value} />;
|
||||||
} else if (chartResult["NAME"] === "DistPlus") {
|
} else if (expression.tag === "distribution") {
|
||||||
return (
|
return (
|
||||||
<DistPlusChart
|
<DistributionChart
|
||||||
distPlus={chartResult.VAL}
|
distribution={expression.value}
|
||||||
height={height}
|
height={height}
|
||||||
width={width}
|
width={width}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else if (chartResult.NAME === "Function") {
|
} else {
|
||||||
return (
|
return (
|
||||||
<FunctionChart
|
<ErrorBox heading="No Viewer">
|
||||||
distPlusFn={chartResult.VAL}
|
{"We don't currently have a viewer for this type: " + expression.tag}
|
||||||
diagramStart={diagramStart}
|
</ErrorBox>
|
||||||
diagramStop={diagramStop}
|
);
|
||||||
diagramCount={diagramCount}
|
}
|
||||||
/>
|
} else {
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return <>{chartResults}</>;
|
|
||||||
} else if (result.tag === "Error") {
|
|
||||||
// At this point, we came across an error. What was our error?
|
// At this point, we came across an error. What was our error?
|
||||||
return <Error heading={"Parse Error"}>{result.value}</Error>;
|
return (
|
||||||
|
<ErrorBox heading={"Parse Error"}>
|
||||||
|
{errorValueToString(expressionResult.value)}
|
||||||
|
</ErrorBox>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as ReactDOM from "react-dom";
|
||||||
import { SquiggleChart } from "./SquiggleChart";
|
import { SquiggleChart } from "./SquiggleChart";
|
||||||
import { CodeEditor } from "./CodeEditor";
|
import { CodeEditor } from "./CodeEditor";
|
||||||
import type { exportEnv } from "@quri/squiggle-lang";
|
import type { exportEnv } from "@quri/squiggle-lang";
|
||||||
import styled from 'styled-components'
|
import styled from "styled-components";
|
||||||
|
|
||||||
export interface SquiggleEditorProps {
|
export interface SquiggleEditorProps {
|
||||||
/** The input string for squiggle */
|
/** The input string for squiggle */
|
||||||
|
|
|
@ -36,10 +36,8 @@ interface Props {
|
||||||
initialSquiggleString?: string;
|
initialSquiggleString?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
let SquigglePlayground: FC<Props> = ({initialSquiggleString=""}: Props) => {
|
let SquigglePlayground: FC<Props> = ({ initialSquiggleString = "" }: Props) => {
|
||||||
let [squiggleString, setSquiggleString] = useState(
|
let [squiggleString, setSquiggleString] = useState(initialSquiggleString);
|
||||||
initialSquiggleString
|
|
||||||
);
|
|
||||||
let [sampleCount, setSampleCount] = useState(1000);
|
let [sampleCount, setSampleCount] = useState(1000);
|
||||||
let [outputXYPoints, setOutputXYPoints] = useState(1000);
|
let [outputXYPoints, setOutputXYPoints] = useState(1000);
|
||||||
let [pointDistLength, setPointDistLength] = useState(1000);
|
let [pointDistLength, setPointDistLength] = useState(1000);
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
export { SquiggleChart } from "./components/SquiggleChart";
|
export { SquiggleChart } from "./components/SquiggleChart";
|
||||||
export { SquiggleEditor, renderSquiggleEditorToDom } from "./components/SquiggleEditor";
|
export {
|
||||||
|
SquiggleEditor,
|
||||||
|
renderSquiggleEditorToDom,
|
||||||
|
} from "./components/SquiggleEditor";
|
||||||
import SquigglePlayground, {
|
import SquigglePlayground, {
|
||||||
renderSquigglePlaygroundToDom,
|
renderSquigglePlaygroundToDom,
|
||||||
} from "./components/SquigglePlayground";
|
} from "./components/SquigglePlayground";
|
||||||
|
|
|
@ -14,10 +14,10 @@ It uses the symbols "K", "M", "B", and "T", to represent thousands, millions, bi
|
||||||
name="Ten Thousand"
|
name="Ten Thousand"
|
||||||
args={{
|
args={{
|
||||||
number: 10000,
|
number: 10000,
|
||||||
precision: 2
|
precision: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{args => <NumberShower {...args}/>}
|
{(args) => <NumberShower {...args} />}
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
|
@ -26,10 +26,10 @@ It uses the symbols "K", "M", "B", and "T", to represent thousands, millions, bi
|
||||||
name="Ten Billion"
|
name="Ten Billion"
|
||||||
args={{
|
args={{
|
||||||
number: 10000000000,
|
number: 10000000000,
|
||||||
precision: 2
|
precision: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{args => <NumberShower {...args}/>}
|
{(args) => <NumberShower {...args} />}
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ It uses the symbols "K", "M", "B", and "T", to represent thousands, millions, bi
|
||||||
name="1.2*10^15"
|
name="1.2*10^15"
|
||||||
args={{
|
args={{
|
||||||
number: 1200000000000000,
|
number: 1200000000000000,
|
||||||
precision: 2
|
precision: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{args => <NumberShower {...args}/>}
|
{(args) => <NumberShower {...args} />}
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
|
@ -50,10 +50,10 @@ It uses the symbols "K", "M", "B", and "T", to represent thousands, millions, bi
|
||||||
name="1.35*10^-13"
|
name="1.35*10^-13"
|
||||||
args={{
|
args={{
|
||||||
number: 0.000000000000135,
|
number: 0.000000000000135,
|
||||||
precision: 2
|
precision: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{args => <NumberShower {...args}/>}
|
{(args) => <NumberShower {...args} />}
|
||||||
</Story>
|
</Story>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,8 @@ could be continuous, discrete or mixed.
|
||||||
<Story
|
<Story
|
||||||
name="Mixed"
|
name="Mixed"
|
||||||
args={{
|
args={{
|
||||||
squiggleString: "mm(0, 1, 3, 5, 8, normal(8, 1), [0.1, 0.3, 0.4, 0.35, 0.2, 0.8])",
|
squiggleString:
|
||||||
|
"mm(0, 1, 3, 5, 8, normal(8, 1), [0.1, 0.3, 0.4, 0.35, 0.2, 0.8])",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Template.bind({})}
|
{Template.bind({})}
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
"shape": {
|
"shape": {
|
||||||
"value": "circle"
|
"value": "circle"
|
||||||
},
|
},
|
||||||
"size": [{"value": 30}],
|
"size": [{ "value": 30 }],
|
||||||
"tooltip": {
|
"tooltip": {
|
||||||
"signal": "datum.y"
|
"signal": "datum.y"
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,11 +96,11 @@
|
||||||
"signals": [
|
"signals": [
|
||||||
{
|
{
|
||||||
"name": "mousemove",
|
"name": "mousemove",
|
||||||
"on": [{"events": "mousemove", "update": "invert('xscale', x())"}]
|
"on": [{ "events": "mousemove", "update": "invert('xscale', x())" }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "mouseout",
|
"name": "mouseout",
|
||||||
"on": [{"events": "mouseout", "update": "invert('xscale', x())"}]
|
"on": [{ "events": "mouseout", "update": "invert('xscale', x())" }]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"axes": [
|
"axes": [
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
"type": "rule",
|
"type": "rule",
|
||||||
"encode": {
|
"encode": {
|
||||||
"update": {
|
"update": {
|
||||||
"xscale": {"scale": "xscale", "signal": "mousemove"}
|
"xscale": { "scale": "xscale", "signal": "mousemove" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,10 +5,12 @@
|
||||||
},
|
},
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
|
"skipLibCheck": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
|
"strict": true,
|
||||||
"preserveConstEnums": true,
|
"preserveConstEnums": true,
|
||||||
"composite": true,
|
"composite": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
|
@ -16,7 +18,10 @@
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"sourceMap": true
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"files": ["src/vega-specs/spec-distributions.json", "src/vega-specs/spec-percentiles.json"],
|
"files": [
|
||||||
|
"src/vega-specs/spec-distributions.json",
|
||||||
|
"src/vega-specs/spec-percentiles.json"
|
||||||
|
],
|
||||||
"target": "ES6",
|
"target": "ES6",
|
||||||
"include": ["src/**/*", "src/*"],
|
"include": ["src/**/*", "src/*"],
|
||||||
"exclude": ["node_modules", "**/*.spec.ts", "webpack.config.js"],
|
"exclude": ["node_modules", "**/*.spec.ts", "webpack.config.js"],
|
||||||
|
|
|
@ -3,13 +3,14 @@ const path = require("path");
|
||||||
module.exports = {
|
module.exports = {
|
||||||
mode: "production",
|
mode: "production",
|
||||||
devtool: "source-map",
|
devtool: "source-map",
|
||||||
|
profile: true,
|
||||||
entry: "./src/index.ts",
|
entry: "./src/index.ts",
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.tsx?$/,
|
test: /\.tsx?$/,
|
||||||
loader: "ts-loader",
|
loader: "ts-loader",
|
||||||
options: { projectReferences: true },
|
options: { projectReferences: true, transpileOnly: true },
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
*.bs.js
|
|
||||||
*.gen.tsx
|
|
||||||
dist
|
|
|
@ -1,11 +1,21 @@
|
||||||
import { run, Distribution, resultMap } from "../src/js/index";
|
import {
|
||||||
|
run,
|
||||||
|
Distribution,
|
||||||
|
resultMap,
|
||||||
|
squiggleExpression,
|
||||||
|
errorValueToString,
|
||||||
|
} from "../src/js/index";
|
||||||
|
|
||||||
let testRun = (x: string) => {
|
let testRun = (x: string): squiggleExpression => {
|
||||||
let result = run(x);
|
let result = run(x, { sampleCount: 100, xyPointLength: 100 });
|
||||||
if (result.tag == "Ok") {
|
expect(result.tag).toEqual("Ok");
|
||||||
return { tag: "Ok", value: result.value.exports };
|
if (result.tag === "Ok") {
|
||||||
|
return result.value;
|
||||||
} else {
|
} else {
|
||||||
return result;
|
throw Error(
|
||||||
|
"Expected squiggle expression to evaluate but got error: " +
|
||||||
|
errorValueToString(result.value)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,29 +26,19 @@ function Ok<b>(x: b) {
|
||||||
describe("Simple calculations and results", () => {
|
describe("Simple calculations and results", () => {
|
||||||
test("mean(normal(5,2))", () => {
|
test("mean(normal(5,2))", () => {
|
||||||
expect(testRun("mean(normal(5,2))")).toEqual({
|
expect(testRun("mean(normal(5,2))")).toEqual({
|
||||||
tag: "Ok",
|
tag: "number",
|
||||||
value: [{ NAME: "Float", VAL: 5 }],
|
value: 5,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
test("10+10", () => {
|
test("10+10", () => {
|
||||||
let foo = testRun("10 + 10");
|
let foo = testRun("10 + 10");
|
||||||
expect(foo).toEqual({ tag: "Ok", value: [{ NAME: "Float", VAL: 20 }] });
|
expect(foo).toEqual({ tag: "number", value: 20 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("Log function", () => {
|
describe("Log function", () => {
|
||||||
test("log(1) = 0", () => {
|
test("log(1) = 0", () => {
|
||||||
let foo = testRun("log(1)");
|
let foo = testRun("log(1)");
|
||||||
expect(foo).toEqual({ tag: "Ok", value: [{ NAME: "Float", VAL: 0 }] });
|
expect(foo).toEqual({ tag: "number", value: 0 });
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("Multimodal too many weights error", () => {
|
|
||||||
test("mm(0,0,[0,0,0])", () => {
|
|
||||||
let foo = testRun("mm(0,0,[0,0,0])");
|
|
||||||
expect(foo).toEqual({
|
|
||||||
tag: "Error",
|
|
||||||
value: "Function multimodal error: Too many weights provided",
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ describe("Distribution", () => {
|
||||||
});
|
});
|
||||||
test("toPointSet", () => {
|
test("toPointSet", () => {
|
||||||
expect(
|
expect(
|
||||||
resultMap(dist.toPointSet(), (r: Distribution) => r.toString()).value
|
resultMap(dist.toPointSet(), (r: Distribution) => r.toString())
|
||||||
).toEqual(Ok("Point Set Distribution"));
|
).toEqual(Ok("Point Set Distribution"));
|
||||||
});
|
});
|
||||||
test("toSparkline", () => {
|
test("toSparkline", () => {
|
||||||
|
|
|
@ -4,7 +4,7 @@ open Jest
|
||||||
open Expect
|
open Expect
|
||||||
|
|
||||||
let expectEvalToBe = (expr: string, answer: string) =>
|
let expectEvalToBe = (expr: string, answer: string) =>
|
||||||
Reducer.eval(expr)->ExpressionValue.toStringResult->expect->toBe(answer)
|
Reducer.evaluate(expr)->ExpressionValue.toStringResult->expect->toBe(answer)
|
||||||
|
|
||||||
describe("builtin", () => {
|
describe("builtin", () => {
|
||||||
// All MathJs operators and functions are available for string, number and boolean
|
// All MathJs operators and functions are available for string, number and boolean
|
||||||
|
|
|
@ -8,4 +8,4 @@ let expectParseToBe = (expr: string, answer: string) =>
|
||||||
Reducer.parse(expr)->Expression.toStringResult->expect->toBe(answer)
|
Reducer.parse(expr)->Expression.toStringResult->expect->toBe(answer)
|
||||||
|
|
||||||
let expectEvalToBe = (expr: string, answer: string) =>
|
let expectEvalToBe = (expr: string, answer: string) =>
|
||||||
Reducer.eval(expr)->ExpressionValue.toStringResult->expect->toBe(answer)
|
Reducer.evaluate(expr)->ExpressionValue.toStringResult->expect->toBe(answer)
|
||||||
|
|
41
packages/squiggle-lang/lint.sh
Executable file
41
packages/squiggle-lang/lint.sh
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Hat tip to @dfalling
|
||||||
|
# https://forum.rescript-lang.org/t/rescript-9-1-how-can-we-format-to-standard-out/1590/2?u=quinn-dougherty
|
||||||
|
|
||||||
|
errors=false
|
||||||
|
|
||||||
|
files=`ls src/rescript/**/**/*.res src/rescript/**/*.res src/rescript/*.res`
|
||||||
|
for file in $files
|
||||||
|
do
|
||||||
|
current=`cat $file`
|
||||||
|
linted=`echo "${current}" | rescript format -stdin .res`
|
||||||
|
diff=`diff <(echo $current) <(echo $linted)`
|
||||||
|
|
||||||
|
if [ ${#diff} -gt 0 ]
|
||||||
|
then
|
||||||
|
echo "ERROR: $file doesn't pass lint"
|
||||||
|
errors=true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
files=`ls src/rescript/**/**/*.resi src/rescript/**/*.resi` # src/rescript/*/resi
|
||||||
|
for file in $files
|
||||||
|
do
|
||||||
|
current=`cat $file`
|
||||||
|
linted=`echo "${current}" | rescript format -stdin .resi`
|
||||||
|
diff=`diff <(echo $current) <(echo $linted)`
|
||||||
|
if [ ${#diff} -gt 0 ]
|
||||||
|
then
|
||||||
|
echo "ERROR: $file doesn't pass lint"
|
||||||
|
errors=true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
if $errors
|
||||||
|
then
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "All files pass lint"
|
||||||
|
fi
|
|
@ -11,6 +11,11 @@
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"test:watch": "jest --watchAll",
|
"test:watch": "jest --watchAll",
|
||||||
"coverage": "rm -f *.coverage; yarn clean; BISECT_ENABLE=yes yarn build; yarn test; bisect-ppx-report html",
|
"coverage": "rm -f *.coverage; yarn clean; BISECT_ENABLE=yes yarn build; yarn test; bisect-ppx-report html",
|
||||||
|
"coverage:ci": "yarn clean; BISECT_ENABLE=yes yarn build; yarn test; bisect-ppx-report send-to Codecov",
|
||||||
|
"lint:rescript": "./lint.sh",
|
||||||
|
"lint:prettier": "prettier --check .",
|
||||||
|
"lint": "yarn lint:rescript && yarn lint:prettier",
|
||||||
|
"format": "rescript format -all && prettier --write .",
|
||||||
"all": "yarn build && yarn bundle && yarn test"
|
"all": "yarn build && yarn bundle && yarn test"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|
|
@ -1,14 +1,26 @@
|
||||||
import { runAll } from "../rescript/ProgramEvaluator.gen";
|
import * as _ from "lodash";
|
||||||
import type {
|
import type {
|
||||||
Inputs_SamplingInputs_t as SamplingInputs,
|
|
||||||
exportEnv,
|
exportEnv,
|
||||||
exportType,
|
|
||||||
exportDistribution,
|
exportDistribution,
|
||||||
} from "../rescript/ProgramEvaluator.gen";
|
} from "../rescript/ProgramEvaluator.gen";
|
||||||
export type { SamplingInputs, exportEnv, exportDistribution };
|
export type { exportEnv, exportDistribution };
|
||||||
export type { t as DistPlus } from "../rescript/OldInterpreter/DistPlus.gen";
|
import {
|
||||||
import { genericDist, env, error } from "../rescript/TypescriptInterface.gen";
|
genericDist,
|
||||||
export { makeSampleSetDist } from "../rescript/TypescriptInterface.gen";
|
samplingParams,
|
||||||
|
evaluate,
|
||||||
|
expressionValue,
|
||||||
|
errorValue,
|
||||||
|
distributionError,
|
||||||
|
toPointSet,
|
||||||
|
continuousShape,
|
||||||
|
discreteShape,
|
||||||
|
distributionErrorToString,
|
||||||
|
} from "../rescript/TypescriptInterface.gen";
|
||||||
|
export {
|
||||||
|
makeSampleSetDist,
|
||||||
|
errorValueToString,
|
||||||
|
distributionErrorToString,
|
||||||
|
} from "../rescript/TypescriptInterface.gen";
|
||||||
import {
|
import {
|
||||||
Constructors_mean,
|
Constructors_mean,
|
||||||
Constructors_sample,
|
Constructors_sample,
|
||||||
|
@ -35,26 +47,14 @@ import {
|
||||||
Constructors_pointwiseLogarithm,
|
Constructors_pointwiseLogarithm,
|
||||||
Constructors_pointwisePower,
|
Constructors_pointwisePower,
|
||||||
} from "../rescript/Distributions/DistributionOperation/DistributionOperation.gen";
|
} from "../rescript/Distributions/DistributionOperation/DistributionOperation.gen";
|
||||||
|
export type { samplingParams, errorValue };
|
||||||
|
|
||||||
export let defaultSamplingInputs: SamplingInputs = {
|
export let defaultSamplingInputs: samplingParams = {
|
||||||
sampleCount: 10000,
|
sampleCount: 10000,
|
||||||
outputXYPoints: 10000,
|
xyPointLength: 10000,
|
||||||
pointDistLength: 1000,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function run(
|
export type result<a, b> =
|
||||||
squiggleString: string,
|
|
||||||
samplingInputs?: SamplingInputs,
|
|
||||||
environment?: exportEnv
|
|
||||||
): result<exportType, string> {
|
|
||||||
let si: SamplingInputs = samplingInputs
|
|
||||||
? samplingInputs
|
|
||||||
: defaultSamplingInputs;
|
|
||||||
let env: exportEnv = environment ? environment : [];
|
|
||||||
return runAll(squiggleString, si, env);
|
|
||||||
}
|
|
||||||
|
|
||||||
type result<a, b> =
|
|
||||||
| {
|
| {
|
||||||
tag: "Ok";
|
tag: "Ok";
|
||||||
value: a;
|
value: a;
|
||||||
|
@ -75,147 +75,264 @@ export function resultMap<a, b, c>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Ok<a, b>(x: a): result<a, b> {
|
||||||
|
return { tag: "Ok", value: x };
|
||||||
|
}
|
||||||
|
|
||||||
|
type tagged<a, b> = { tag: a; value: b };
|
||||||
|
|
||||||
|
function tag<a, b>(x: a, y: b): tagged<a, b> {
|
||||||
|
return { tag: x, value: y };
|
||||||
|
}
|
||||||
|
|
||||||
|
export type squiggleExpression =
|
||||||
|
| tagged<"symbol", string>
|
||||||
|
| tagged<"string", string>
|
||||||
|
| tagged<"array", squiggleExpression[]>
|
||||||
|
| tagged<"boolean", boolean>
|
||||||
|
| tagged<"distribution", Distribution>
|
||||||
|
| tagged<"number", number>
|
||||||
|
| tagged<"record", { [key: string]: squiggleExpression }>;
|
||||||
|
export function run(
|
||||||
|
squiggleString: string,
|
||||||
|
samplingInputs?: samplingParams,
|
||||||
|
_environment?: exportEnv
|
||||||
|
): result<squiggleExpression, errorValue> {
|
||||||
|
let si: samplingParams = samplingInputs
|
||||||
|
? samplingInputs
|
||||||
|
: defaultSamplingInputs;
|
||||||
|
let result: result<expressionValue, errorValue> = evaluate(squiggleString);
|
||||||
|
return resultMap(result, (x) => createTsExport(x, si));
|
||||||
|
}
|
||||||
|
|
||||||
|
function createTsExport(
|
||||||
|
x: expressionValue,
|
||||||
|
sampEnv: samplingParams
|
||||||
|
): squiggleExpression {
|
||||||
|
switch (x.tag) {
|
||||||
|
case "EvArray":
|
||||||
|
return tag(
|
||||||
|
"array",
|
||||||
|
x.value.map((x) => createTsExport(x, sampEnv))
|
||||||
|
);
|
||||||
|
case "EvBool":
|
||||||
|
return tag("boolean", x.value);
|
||||||
|
case "EvDistribution":
|
||||||
|
return tag("distribution", new Distribution(x.value, sampEnv));
|
||||||
|
case "EvNumber":
|
||||||
|
return tag("number", x.value);
|
||||||
|
case "EvRecord":
|
||||||
|
return tag(
|
||||||
|
"record",
|
||||||
|
_.mapValues(x.value, (x) => createTsExport(x, sampEnv))
|
||||||
|
);
|
||||||
|
case "EvString":
|
||||||
|
return tag("string", x.value);
|
||||||
|
case "EvSymbol":
|
||||||
|
return tag("symbol", x.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function resultExn<a, c>(r: result<a, c>): a | c {
|
export function resultExn<a, c>(r: result<a, c>): a | c {
|
||||||
return r.value;
|
return r.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type point = { x: number; y: number };
|
||||||
|
|
||||||
|
export type shape = {
|
||||||
|
continuous: point[];
|
||||||
|
discrete: point[];
|
||||||
|
};
|
||||||
|
|
||||||
|
function shapePoints(x: continuousShape | discreteShape): point[] {
|
||||||
|
let xs = x.xyShape.xs;
|
||||||
|
let ys = x.xyShape.ys;
|
||||||
|
return _.zipWith(xs, ys, (x, y) => ({ x, y }));
|
||||||
|
}
|
||||||
|
|
||||||
export class Distribution {
|
export class Distribution {
|
||||||
t: genericDist;
|
t: genericDist;
|
||||||
env: env;
|
env: samplingParams;
|
||||||
|
|
||||||
constructor(t: genericDist, env: env) {
|
constructor(t: genericDist, env: samplingParams) {
|
||||||
this.t = t;
|
this.t = t;
|
||||||
this.env = env;
|
this.env = env;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
mapResultDist(r: result<genericDist, error>): result<Distribution, error> {
|
mapResultDist(
|
||||||
|
r: result<genericDist, distributionError>
|
||||||
|
): result<Distribution, distributionError> {
|
||||||
return resultMap(r, (v: genericDist) => new Distribution(v, this.env));
|
return resultMap(r, (v: genericDist) => new Distribution(v, this.env));
|
||||||
}
|
}
|
||||||
|
|
||||||
mean(): result<number, error> {
|
mean(): result<number, distributionError> {
|
||||||
return Constructors_mean({ env: this.env }, this.t);
|
return Constructors_mean({ env: this.env }, this.t);
|
||||||
}
|
}
|
||||||
|
|
||||||
sample(): result<number, error> {
|
sample(): result<number, distributionError> {
|
||||||
return Constructors_sample({ env: this.env }, this.t);
|
return Constructors_sample({ env: this.env }, this.t);
|
||||||
}
|
}
|
||||||
|
|
||||||
pdf(n: number): result<number, error> {
|
pdf(n: number): result<number, distributionError> {
|
||||||
return Constructors_pdf({ env: this.env }, this.t, n);
|
return Constructors_pdf({ env: this.env }, this.t, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
cdf(n: number): result<number, error> {
|
cdf(n: number): result<number, distributionError> {
|
||||||
return Constructors_cdf({ env: this.env }, this.t, n);
|
return Constructors_cdf({ env: this.env }, this.t, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
inv(n: number): result<number, error> {
|
inv(n: number): result<number, distributionError> {
|
||||||
return Constructors_inv({ env: this.env }, this.t, n);
|
return Constructors_inv({ env: this.env }, this.t, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
normalize(): result<Distribution, error> {
|
normalize(): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_normalize({ env: this.env }, this.t)
|
Constructors_normalize({ env: this.env }, this.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toPointSet(): result<Distribution, error> {
|
pointSet(): result<shape, distributionError> {
|
||||||
|
let pointSet = toPointSet(
|
||||||
|
this.t,
|
||||||
|
{
|
||||||
|
xyPointLength: this.env.xyPointLength,
|
||||||
|
sampleCount: this.env.sampleCount,
|
||||||
|
},
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
if (pointSet.tag === "Ok") {
|
||||||
|
let distribution = pointSet.value;
|
||||||
|
if (distribution.tag === "Continuous") {
|
||||||
|
return Ok({
|
||||||
|
continuous: shapePoints(distribution.value),
|
||||||
|
discrete: [],
|
||||||
|
});
|
||||||
|
} else if (distribution.tag === "Discrete") {
|
||||||
|
return Ok({
|
||||||
|
discrete: shapePoints(distribution.value),
|
||||||
|
continuous: [],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return Ok({
|
||||||
|
discrete: shapePoints(distribution.value.discrete),
|
||||||
|
continuous: shapePoints(distribution.value.continuous),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return pointSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toPointSet(): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_toPointSet({ env: this.env }, this.t)
|
Constructors_toPointSet({ env: this.env }, this.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
toSampleSet(n: number): result<Distribution, error> {
|
toSampleSet(n: number): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_toSampleSet({ env: this.env }, this.t, n)
|
Constructors_toSampleSet({ env: this.env }, this.t, n)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
truncate(left: number, right: number): result<Distribution, error> {
|
truncate(
|
||||||
|
left: number,
|
||||||
|
right: number
|
||||||
|
): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_truncate({ env: this.env }, this.t, left, right)
|
Constructors_truncate({ env: this.env }, this.t, left, right)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
inspect(): result<Distribution, error> {
|
inspect(): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(Constructors_inspect({ env: this.env }, this.t));
|
return this.mapResultDist(Constructors_inspect({ env: this.env }, this.t));
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(): result<string, error> {
|
toString(): string {
|
||||||
return Constructors_toString({ env: this.env }, this.t);
|
let result = Constructors_toString({ env: this.env }, this.t);
|
||||||
|
if (result.tag === "Ok") {
|
||||||
|
return result.value;
|
||||||
|
} else {
|
||||||
|
return distributionErrorToString(result.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toSparkline(n: number): result<string, error> {
|
toSparkline(n: number): result<string, distributionError> {
|
||||||
return Constructors_toSparkline({ env: this.env }, this.t, n);
|
return Constructors_toSparkline({ env: this.env }, this.t, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
algebraicAdd(d2: Distribution): result<Distribution, error> {
|
algebraicAdd(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_algebraicAdd({ env: this.env }, this.t, d2.t)
|
Constructors_algebraicAdd({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
algebraicMultiply(d2: Distribution): result<Distribution, error> {
|
algebraicMultiply(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_algebraicMultiply({ env: this.env }, this.t, d2.t)
|
Constructors_algebraicMultiply({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
algebraicDivide(d2: Distribution): result<Distribution, error> {
|
algebraicDivide(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_algebraicDivide({ env: this.env }, this.t, d2.t)
|
Constructors_algebraicDivide({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
algebraicSubtract(d2: Distribution): result<Distribution, error> {
|
algebraicSubtract(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_algebraicSubtract({ env: this.env }, this.t, d2.t)
|
Constructors_algebraicSubtract({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
algebraicLogarithm(d2: Distribution): result<Distribution, error> {
|
algebraicLogarithm(
|
||||||
|
d2: Distribution
|
||||||
|
): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_algebraicLogarithm({ env: this.env }, this.t, d2.t)
|
Constructors_algebraicLogarithm({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
algebraicPower(d2: Distribution): result<Distribution, error> {
|
algebraicPower(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_algebraicPower({ env: this.env }, this.t, d2.t)
|
Constructors_algebraicPower({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointwiseAdd(d2: Distribution): result<Distribution, error> {
|
pointwiseAdd(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_pointwiseAdd({ env: this.env }, this.t, d2.t)
|
Constructors_pointwiseAdd({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointwiseMultiply(d2: Distribution): result<Distribution, error> {
|
pointwiseMultiply(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_pointwiseMultiply({ env: this.env }, this.t, d2.t)
|
Constructors_pointwiseMultiply({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointwiseDivide(d2: Distribution): result<Distribution, error> {
|
pointwiseDivide(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_pointwiseDivide({ env: this.env }, this.t, d2.t)
|
Constructors_pointwiseDivide({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointwiseSubtract(d2: Distribution): result<Distribution, error> {
|
pointwiseSubtract(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_pointwiseSubtract({ env: this.env }, this.t, d2.t)
|
Constructors_pointwiseSubtract({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointwiseLogarithm(d2: Distribution): result<Distribution, error> {
|
pointwiseLogarithm(
|
||||||
|
d2: Distribution
|
||||||
|
): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_pointwiseLogarithm({ env: this.env }, this.t, d2.t)
|
Constructors_pointwiseLogarithm({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pointwisePower(d2: Distribution): result<Distribution, error> {
|
pointwisePower(d2: Distribution): result<Distribution, distributionError> {
|
||||||
return this.mapResultDist(
|
return this.mapResultDist(
|
||||||
Constructors_pointwisePower({ env: this.env }, this.t, d2.t)
|
Constructors_pointwisePower({ env: this.env }, this.t, d2.t)
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,6 +21,7 @@ let toFloatOperation: (
|
||||||
~distToFloatOperation: Operation.distToFloatOperation,
|
~distToFloatOperation: Operation.distToFloatOperation,
|
||||||
) => result<float, error>
|
) => result<float, error>
|
||||||
|
|
||||||
|
@genType
|
||||||
let toPointSet: (
|
let toPointSet: (
|
||||||
t,
|
t,
|
||||||
~xyPointLength: int,
|
~xyPointLength: int,
|
||||||
|
|
|
@ -10,11 +10,22 @@ type error =
|
||||||
| DistributionVerticalShiftIsInvalid
|
| DistributionVerticalShiftIsInvalid
|
||||||
| Other(string)
|
| Other(string)
|
||||||
|
|
||||||
|
@genType
|
||||||
module Error = {
|
module Error = {
|
||||||
type t = error
|
type t = error
|
||||||
|
|
||||||
let fromString = (s: string): t => Other(s)
|
let fromString = (s: string): t => Other(s)
|
||||||
|
|
||||||
|
@genType
|
||||||
|
let toString = (x: t) => {
|
||||||
|
switch x {
|
||||||
|
| NotYetImplemented => "Not Yet Implemented"
|
||||||
|
| Unreachable => "Unreachable"
|
||||||
|
| DistributionVerticalShiftIsInvalid => "Distribution Vertical Shift Is Invalid"
|
||||||
|
| Other(s) => s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let resultStringToResultError: result<'a, string> => result<'a, error> = n =>
|
let resultStringToResultError: result<'a, string> => result<'a, error> = n =>
|
||||||
n->E.R2.errMap(r => r->fromString->Error)
|
n->E.R2.errMap(r => r->fromString->Error)
|
||||||
}
|
}
|
||||||
|
@ -51,6 +62,7 @@ module Operation = {
|
||||||
| #Sample
|
| #Sample
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@genType
|
||||||
type pointsetXSelection = [#Linear | #ByWeight]
|
type pointsetXSelection = [#Linear | #ByWeight]
|
||||||
|
|
||||||
type toDist =
|
type toDist =
|
||||||
|
|
|
@ -19,6 +19,7 @@ type interpolationStrategy = XYShape.interpolationStrategy;
|
||||||
type extrapolationStrategy = XYShape.extrapolationStrategy;
|
type extrapolationStrategy = XYShape.extrapolationStrategy;
|
||||||
type interpolator = XYShape.extrapolationStrategy;
|
type interpolator = XYShape.extrapolationStrategy;
|
||||||
|
|
||||||
|
@genType
|
||||||
type rec continuousShape = {
|
type rec continuousShape = {
|
||||||
xyShape: xyShape,
|
xyShape: xyShape,
|
||||||
interpolation: interpolationStrategy,
|
interpolation: interpolationStrategy,
|
||||||
|
@ -26,12 +27,14 @@ type rec continuousShape = {
|
||||||
integralCache: option<continuousShape>,
|
integralCache: option<continuousShape>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@genType
|
||||||
type discreteShape = {
|
type discreteShape = {
|
||||||
xyShape: xyShape,
|
xyShape: xyShape,
|
||||||
integralSumCache: option<float>,
|
integralSumCache: option<float>,
|
||||||
integralCache: option<continuousShape>,
|
integralCache: option<continuousShape>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@genType
|
||||||
type mixedShape = {
|
type mixedShape = {
|
||||||
continuous: continuousShape,
|
continuous: continuousShape,
|
||||||
discrete: discreteShape,
|
discrete: discreteShape,
|
||||||
|
|
|
@ -213,19 +213,20 @@ module SamplingDistribution = {
|
||||||
let i1 = renderIfIsNotSamplingDistribution(evaluationParams, t1)
|
let i1 = renderIfIsNotSamplingDistribution(evaluationParams, t1)
|
||||||
let i2 = renderIfIsNotSamplingDistribution(evaluationParams, t2)
|
let i2 = renderIfIsNotSamplingDistribution(evaluationParams, t2)
|
||||||
E.R.merge(i1, i2) |> E.R.bind(_, ((a, b)) => {
|
E.R.merge(i1, i2) |> E.R.bind(_, ((a, b)) => {
|
||||||
let samples = getCombinationSamples(
|
let samples =
|
||||||
evaluationParams.samplingInputs.sampleCount,
|
getCombinationSamples(
|
||||||
algebraicOp,
|
evaluationParams.samplingInputs.sampleCount,
|
||||||
a,
|
algebraicOp,
|
||||||
b,
|
a,
|
||||||
) |> E.O.toResult("Could not get samples")
|
b,
|
||||||
|
) |> E.O.toResult("Could not get samples")
|
||||||
|
|
||||||
let sampleSetDist = samples -> E.R.bind(SampleSetDist.make)
|
let sampleSetDist = samples->E.R.bind(SampleSetDist.make)
|
||||||
|
|
||||||
let pointSetDist =
|
let pointSetDist =
|
||||||
sampleSetDist
|
sampleSetDist->E.R.bind(r =>
|
||||||
-> E.R.bind(r =>
|
SampleSetDist.toPointSetDist(~samplingInputs=evaluationParams.samplingInputs, ~samples=r)
|
||||||
SampleSetDist.toPointSetDist(~samplingInputs=evaluationParams.samplingInputs, ~samples=r));
|
)
|
||||||
pointSetDist |> E.R.fmap(r => #Normalize(#RenderedDist(r)))
|
pointSetDist |> E.R.fmap(r => #Normalize(#RenderedDist(r)))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,116 +1,87 @@
|
||||||
open PointSetTypes;
|
open PointSetTypes
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type t = PointSetTypes.distPlus;
|
type t = PointSetTypes.distPlus
|
||||||
|
|
||||||
let pointSetDistIntegral = pointSetDist => PointSetDist.T.Integral.get(pointSetDist);
|
let pointSetDistIntegral = pointSetDist => PointSetDist.T.Integral.get(pointSetDist)
|
||||||
let make =
|
let make = (~pointSetDist, ~squiggleString, ()): t => {
|
||||||
(
|
let integral = pointSetDistIntegral(pointSetDist)
|
||||||
~pointSetDist,
|
{pointSetDist: pointSetDist, integralCache: integral, squiggleString: squiggleString}
|
||||||
~squiggleString,
|
}
|
||||||
(),
|
|
||||||
)
|
|
||||||
: t => {
|
|
||||||
let integral = pointSetDistIntegral(pointSetDist);
|
|
||||||
{pointSetDist, integralCache: integral, squiggleString};
|
|
||||||
};
|
|
||||||
|
|
||||||
let update =
|
let update = (~pointSetDist=?, ~integralCache=?, ~squiggleString=?, t: t) => {
|
||||||
(
|
|
||||||
~pointSetDist=?,
|
|
||||||
~integralCache=?,
|
|
||||||
~squiggleString=?,
|
|
||||||
t: t,
|
|
||||||
) => {
|
|
||||||
pointSetDist: E.O.default(t.pointSetDist, pointSetDist),
|
pointSetDist: E.O.default(t.pointSetDist, pointSetDist),
|
||||||
integralCache: E.O.default(t.integralCache, integralCache),
|
integralCache: E.O.default(t.integralCache, integralCache),
|
||||||
squiggleString: E.O.default(t.squiggleString, squiggleString),
|
squiggleString: E.O.default(t.squiggleString, squiggleString),
|
||||||
};
|
}
|
||||||
|
|
||||||
let updateShape = (pointSetDist, t) => {
|
let updateShape = (pointSetDist, t) => {
|
||||||
let integralCache = pointSetDistIntegral(pointSetDist);
|
let integralCache = pointSetDistIntegral(pointSetDist)
|
||||||
update(~pointSetDist, ~integralCache, t);
|
update(~pointSetDist, ~integralCache, t)
|
||||||
};
|
}
|
||||||
|
|
||||||
let toPointSetDist = ({pointSetDist, _}: t) => pointSetDist;
|
let toPointSetDist = ({pointSetDist, _}: t) => pointSetDist
|
||||||
|
|
||||||
let pointSetDistFn = (fn, {pointSetDist}: t) => fn(pointSetDist);
|
let pointSetDistFn = (fn, {pointSetDist}: t) => fn(pointSetDist)
|
||||||
|
|
||||||
module T =
|
module T = Distributions.Dist({
|
||||||
Distributions.Dist({
|
type t = PointSetTypes.distPlus
|
||||||
type t = PointSetTypes.distPlus;
|
type integral = PointSetTypes.distPlus
|
||||||
type integral = PointSetTypes.distPlus;
|
let toPointSetDist = toPointSetDist
|
||||||
let toPointSetDist = toPointSetDist;
|
let toContinuous = pointSetDistFn(PointSetDist.T.toContinuous)
|
||||||
let toContinuous = pointSetDistFn(PointSetDist.T.toContinuous);
|
let toDiscrete = pointSetDistFn(PointSetDist.T.toDiscrete)
|
||||||
let toDiscrete = pointSetDistFn(PointSetDist.T.toDiscrete);
|
|
||||||
|
|
||||||
let normalize = (t: t): t => {
|
let normalize = (t: t): t => {
|
||||||
let normalizedShape = t |> toPointSetDist |> PointSetDist.T.normalize;
|
let normalizedShape = t |> toPointSetDist |> PointSetDist.T.normalize
|
||||||
t |> updateShape(normalizedShape);
|
t |> updateShape(normalizedShape)
|
||||||
};
|
}
|
||||||
|
|
||||||
let truncate = (leftCutoff, rightCutoff, t: t): t => {
|
let truncate = (leftCutoff, rightCutoff, t: t): t => {
|
||||||
let truncatedShape =
|
let truncatedShape = t |> toPointSetDist |> PointSetDist.T.truncate(leftCutoff, rightCutoff)
|
||||||
t
|
|
||||||
|> toPointSetDist
|
|
||||||
|> PointSetDist.T.truncate(leftCutoff, rightCutoff);
|
|
||||||
|
|
||||||
t |> updateShape(truncatedShape);
|
t |> updateShape(truncatedShape)
|
||||||
};
|
}
|
||||||
|
|
||||||
let xToY = (f, t: t) =>
|
let xToY = (f, t: t) => t |> toPointSetDist |> PointSetDist.T.xToY(f)
|
||||||
t
|
|
||||||
|> toPointSetDist
|
|
||||||
|> PointSetDist.T.xToY(f);
|
|
||||||
|
|
||||||
let minX = pointSetDistFn(PointSetDist.T.minX);
|
let minX = pointSetDistFn(PointSetDist.T.minX)
|
||||||
let maxX = pointSetDistFn(PointSetDist.T.maxX);
|
let maxX = pointSetDistFn(PointSetDist.T.maxX)
|
||||||
let toDiscreteProbabilityMassFraction =
|
let toDiscreteProbabilityMassFraction = pointSetDistFn(
|
||||||
pointSetDistFn(PointSetDist.T.toDiscreteProbabilityMassFraction);
|
PointSetDist.T.toDiscreteProbabilityMassFraction,
|
||||||
|
)
|
||||||
|
|
||||||
// This bit is kind of awkward, could probably use rethinking.
|
// This bit is kind of awkward, could probably use rethinking.
|
||||||
let integral = (t: t) =>
|
let integral = (t: t) => updateShape(Continuous(t.integralCache), t)
|
||||||
updateShape(Continuous(t.integralCache), t);
|
|
||||||
|
|
||||||
let updateIntegralCache = (integralCache: option<PointSetTypes.continuousShape>, t) =>
|
let updateIntegralCache = (integralCache: option<PointSetTypes.continuousShape>, t) =>
|
||||||
update(~integralCache=E.O.default(t.integralCache, integralCache), t);
|
update(~integralCache=E.O.default(t.integralCache, integralCache), t)
|
||||||
|
|
||||||
let downsample = (i, t): t =>
|
let downsample = (i, t): t => updateShape(t |> toPointSetDist |> PointSetDist.T.downsample(i), t)
|
||||||
updateShape(t |> toPointSetDist |> PointSetDist.T.downsample(i), t);
|
// todo: adjust for limit, maybe?
|
||||||
// todo: adjust for limit, maybe?
|
let mapY = (
|
||||||
let mapY =
|
~integralSumCacheFn=previousIntegralSum => None,
|
||||||
(
|
~integralCacheFn=previousIntegralCache => None,
|
||||||
~integralSumCacheFn=previousIntegralSum => None,
|
~fn,
|
||||||
~integralCacheFn=previousIntegralCache => None,
|
{pointSetDist, _} as t: t,
|
||||||
~fn,
|
): t => PointSetDist.T.mapY(~integralSumCacheFn, ~fn, pointSetDist) |> updateShape(_, t)
|
||||||
{pointSetDist, _} as t: t,
|
|
||||||
)
|
|
||||||
: t =>
|
|
||||||
PointSetDist.T.mapY(~integralSumCacheFn, ~fn, pointSetDist)
|
|
||||||
|> updateShape(_, t);
|
|
||||||
|
|
||||||
// get the total of everything
|
// get the total of everything
|
||||||
let integralEndY = (t: t) => {
|
let integralEndY = (t: t) => {
|
||||||
PointSetDist.T.Integral.sum(
|
PointSetDist.T.Integral.sum(toPointSetDist(t))
|
||||||
toPointSetDist(t),
|
}
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: Fix this below, obviously. Adjust for limits
|
// TODO: Fix this below, obviously. Adjust for limits
|
||||||
let integralXtoY = (f, t: t) => {
|
let integralXtoY = (f, t: t) => {
|
||||||
PointSetDist.T.Integral.xToY(
|
PointSetDist.T.Integral.xToY(f, toPointSetDist(t))
|
||||||
f,
|
}
|
||||||
toPointSetDist(t),
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: This part is broken when there is a limit, if this is supposed to be taken into account.
|
// TODO: This part is broken when there is a limit, if this is supposed to be taken into account.
|
||||||
let integralYtoX = (f, t: t) => {
|
let integralYtoX = (f, t: t) => {
|
||||||
PointSetDist.T.Integral.yToX(f, toPointSetDist(t));
|
PointSetDist.T.Integral.yToX(f, toPointSetDist(t))
|
||||||
};
|
}
|
||||||
|
|
||||||
let mean = (t: t) => {
|
let mean = (t: t) => {
|
||||||
PointSetDist.T.mean(t.pointSetDist);
|
PointSetDist.T.mean(t.pointSetDist)
|
||||||
};
|
}
|
||||||
let variance = (t: t) => PointSetDist.T.variance(t.pointSetDist);
|
let variance = (t: t) => PointSetDist.T.variance(t.pointSetDist)
|
||||||
});
|
})
|
||||||
|
|
|
@ -121,17 +121,14 @@ module MathAdtToDistDst = {
|
||||||
| (_, _, Ok(mu), Ok(sigma)) => Ok(#FunctionCall("lognormal", [mu, sigma]))
|
| (_, _, Ok(mu), Ok(sigma)) => Ok(#FunctionCall("lognormal", [mu, sigma]))
|
||||||
| _ => Error("Lognormal distribution needs either mean and stdev or mu and 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")
|
// Error("Dotwise exponentiation needs two operands")
|
||||||
let operationParser = (
|
let operationParser = (name: string, args: result<array<ASTTypes.node>, string>): result<
|
||||||
name: string,
|
ASTTypes.node,
|
||||||
args: result<array<ASTTypes.node>, string>,
|
string,
|
||||||
): result<ASTTypes.node, string> => {
|
> => {
|
||||||
let toOkAlgebraic = r => Ok(#AlgebraicCombination(r))
|
let toOkAlgebraic = r => Ok(#AlgebraicCombination(r))
|
||||||
let toOkPointwise = r => Ok(#PointwiseCombination(r))
|
let toOkPointwise = r => Ok(#PointwiseCombination(r))
|
||||||
let toOkTruncate = r => Ok(#Truncate(r))
|
let toOkTruncate = r => Ok(#Truncate(r))
|
||||||
|
@ -169,10 +166,7 @@ module MathAdtToDistDst = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let functionParser = (
|
let functionParser = (
|
||||||
nodeParser: MathJsonToMathJsAdt.arg => Belt.Result.t<
|
nodeParser: MathJsonToMathJsAdt.arg => Belt.Result.t<ASTTypes.node, string>,
|
||||||
ASTTypes.node,
|
|
||||||
string,
|
|
||||||
>,
|
|
||||||
name: string,
|
name: string,
|
||||||
args: array<MathJsonToMathJsAdt.arg>,
|
args: array<MathJsonToMathJsAdt.arg>,
|
||||||
): result<ASTTypes.node, string> => {
|
): result<ASTTypes.node, string> => {
|
||||||
|
@ -224,17 +218,11 @@ module MathAdtToDistDst = {
|
||||||
)
|
)
|
||||||
Ok(hash)
|
Ok(hash)
|
||||||
}
|
}
|
||||||
| name =>
|
| name => parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) => #FunctionCall(name, args))
|
||||||
parseArgs() |> E.R.fmap((args: array<ASTTypes.node>) =>
|
|
||||||
#FunctionCall(name, args)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let rec nodeParser: MathJsonToMathJsAdt.arg => result<
|
let rec nodeParser: MathJsonToMathJsAdt.arg => result<ASTTypes.node, string> = x =>
|
||||||
ASTTypes.node,
|
|
||||||
string,
|
|
||||||
> = x =>
|
|
||||||
switch x {
|
switch x {
|
||||||
| Value(f) => Ok(#SymbolicDist(#Float(f)))
|
| Value(f) => Ok(#SymbolicDist(#Float(f)))
|
||||||
| Symbol(sym) => Ok(#Symbol(sym))
|
| 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)
|
blocks |> E.A.fmap(b => topLevel(b)) |> E.A.R.firstErrorOrOpen |> E.R.fmap(E.A.concatMany)
|
||||||
}
|
}
|
||||||
|
|
||||||
let run = (r): result<ASTTypes.program, string> =>
|
let run = (r): result<ASTTypes.program, string> => r |> MathAdtCleaner.run |> topLevel
|
||||||
r |> MathAdtCleaner.run |> topLevel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The MathJs parser doesn't support '.+' syntax, but we want it because it
|
/* The MathJs parser doesn't support '.+' syntax, but we want it because it
|
||||||
|
|
|
@ -39,17 +39,16 @@ module Inputs = {
|
||||||
type exportDistribution = [
|
type exportDistribution = [
|
||||||
| #DistPlus(DistPlus.t)
|
| #DistPlus(DistPlus.t)
|
||||||
| #Float(float)
|
| #Float(float)
|
||||||
| #Function((float) => Belt.Result.t<DistPlus.t,string>)
|
| #Function(float => Belt.Result.t<DistPlus.t, string>)
|
||||||
]
|
]
|
||||||
|
|
||||||
type exportEnv = array<(string, ASTTypes.node)>
|
type exportEnv = array<(string, ASTTypes.node)>
|
||||||
|
|
||||||
type exportType = {
|
type exportType = {
|
||||||
environment : exportEnv,
|
environment: exportEnv,
|
||||||
exports: array<exportDistribution>
|
exports: array<exportDistribution>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module Internals = {
|
module Internals = {
|
||||||
let addVariable = (
|
let addVariable = (
|
||||||
{samplingInputs, squiggleString, environment}: Inputs.inputs,
|
{samplingInputs, squiggleString, environment}: Inputs.inputs,
|
||||||
|
@ -58,9 +57,7 @@ module Internals = {
|
||||||
): Inputs.inputs => {
|
): Inputs.inputs => {
|
||||||
samplingInputs: samplingInputs,
|
samplingInputs: samplingInputs,
|
||||||
squiggleString: squiggleString,
|
squiggleString: squiggleString,
|
||||||
environment: ASTTypes.Environment.update(environment, str, _ => Some(
|
environment: ASTTypes.Environment.update(environment, str, _ => Some(node)),
|
||||||
node,
|
|
||||||
)),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type outputs = {
|
type outputs = {
|
||||||
|
@ -76,8 +73,7 @@ module Internals = {
|
||||||
pointSetDistLength: inputs.samplingInputs.pointDistLength |> E.O.default(10000),
|
pointSetDistLength: inputs.samplingInputs.pointDistLength |> E.O.default(10000),
|
||||||
}
|
}
|
||||||
|
|
||||||
let runNode = (inputs, node) =>
|
let runNode = (inputs, node) => AST.toLeaf(makeInputs(inputs), inputs.environment, node)
|
||||||
AST.toLeaf(makeInputs(inputs), inputs.environment, node)
|
|
||||||
|
|
||||||
let renderIfNeeded = (inputs: Inputs.inputs, node: ASTTypes.node): result<
|
let renderIfNeeded = (inputs: Inputs.inputs, node: ASTTypes.node): result<
|
||||||
ASTTypes.node,
|
ASTTypes.node,
|
||||||
|
@ -106,16 +102,14 @@ module Internals = {
|
||||||
let outputToDistPlus = (inputs: Inputs.inputs, pointSetDist: PointSetTypes.pointSetDist) =>
|
let outputToDistPlus = (inputs: Inputs.inputs, pointSetDist: PointSetTypes.pointSetDist) =>
|
||||||
DistPlus.make(~pointSetDist, ~squiggleString=Some(inputs.squiggleString), ())
|
DistPlus.make(~pointSetDist, ~squiggleString=Some(inputs.squiggleString), ())
|
||||||
|
|
||||||
let rec returnDist = (functionInfo : (array<string>, ASTTypes.node),
|
let rec returnDist = (
|
||||||
inputs : Inputs.inputs,
|
functionInfo: (array<string>, ASTTypes.node),
|
||||||
env : ASTTypes.environment) => {
|
inputs: Inputs.inputs,
|
||||||
(input : float) => {
|
env: ASTTypes.environment,
|
||||||
let foo: Inputs.inputs = {...inputs, environment: env};
|
) => {
|
||||||
evaluateFunction(
|
(input: float) => {
|
||||||
foo,
|
let foo: Inputs.inputs = {...inputs, environment: env}
|
||||||
functionInfo,
|
evaluateFunction(foo, functionInfo, [#SymbolicDist(#Float(input))]) |> E.R.bind(_, a =>
|
||||||
[#SymbolicDist(#Float(input))],
|
|
||||||
) |> E.R.bind(_, a =>
|
|
||||||
switch a {
|
switch a {
|
||||||
| #DistPlus(d) => Ok(DistPlus.T.normalize(d))
|
| #DistPlus(d) => Ok(DistPlus.T.normalize(d))
|
||||||
| n =>
|
| n =>
|
||||||
|
@ -126,11 +120,10 @@ module Internals = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Consider using ExpressionTypes.ExpressionTree.getFloat or similar in this function
|
// TODO: Consider using ExpressionTypes.ExpressionTree.getFloat or similar in this function
|
||||||
and coersionToExportedTypes = (
|
and coersionToExportedTypes = (inputs, env: ASTTypes.environment, ex: ASTTypes.node): result<
|
||||||
inputs,
|
exportDistribution,
|
||||||
env: ASTTypes.environment,
|
string,
|
||||||
ex: ASTTypes.node,
|
> =>
|
||||||
): result<exportDistribution, string> =>
|
|
||||||
ex
|
ex
|
||||||
|> renderIfNeeded(inputs)
|
|> renderIfNeeded(inputs)
|
||||||
|> E.R.bind(_, x =>
|
|> E.R.bind(_, x =>
|
||||||
|
@ -143,56 +136,45 @@ module Internals = {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
and evaluateFunction = (
|
and evaluateFunction = (inputs: Inputs.inputs, fn: (array<string>, ASTTypes.node), fnInputs) => {
|
||||||
inputs: Inputs.inputs,
|
let output = AST.runFunction(makeInputs(inputs), inputs.environment, fnInputs, fn)
|
||||||
fn: (array<string>, ASTTypes.node),
|
|
||||||
fnInputs,
|
|
||||||
) => {
|
|
||||||
let output = AST.runFunction(
|
|
||||||
makeInputs(inputs),
|
|
||||||
inputs.environment,
|
|
||||||
fnInputs,
|
|
||||||
fn,
|
|
||||||
)
|
|
||||||
output |> E.R.bind(_, coersionToExportedTypes(inputs, inputs.environment))
|
output |> E.R.bind(_, coersionToExportedTypes(inputs, inputs.environment))
|
||||||
}
|
}
|
||||||
|
|
||||||
let runProgram = (inputs: Inputs.inputs, p: ASTTypes.program) => {
|
let runProgram = (inputs: Inputs.inputs, p: ASTTypes.program) => {
|
||||||
let ins = ref(inputs)
|
let ins = ref(inputs)
|
||||||
p
|
p
|
||||||
|> E.A.fmap(x =>
|
|> E.A.fmap(x =>
|
||||||
switch x {
|
switch x {
|
||||||
| #Assignment(name, node) =>
|
| #Assignment(name, node) =>
|
||||||
ins := addVariable(ins.contents, name, node)
|
ins := addVariable(ins.contents, name, node)
|
||||||
None
|
None
|
||||||
| #Expression(node) =>
|
| #Expression(node) => Some(runNode(ins.contents, node))
|
||||||
Some(runNode(ins.contents, node))
|
}
|
||||||
}
|
)
|
||||||
)
|
|> E.A.O.concatSomes
|
||||||
|> E.A.O.concatSomes
|
|> E.A.R.firstErrorOrOpen
|
||||||
|
|> E.R.bind(_, d =>
|
||||||
|
d
|
||||||
|
|> E.A.fmap(x => coersionToExportedTypes(inputs, ins.contents.environment, x))
|
||||||
|> E.A.R.firstErrorOrOpen
|
|> E.A.R.firstErrorOrOpen
|
||||||
|> E.R.bind(_, d =>
|
)
|
||||||
d
|
|> E.R.fmap(ex => {
|
||||||
|> E.A.fmap(x => coersionToExportedTypes(inputs, ins.contents.environment, x))
|
environment: Belt.Map.String.toArray(ins.contents.environment),
|
||||||
|> E.A.R.firstErrorOrOpen
|
exports: ex,
|
||||||
)
|
})
|
||||||
|> E.R.fmap(ex =>
|
|
||||||
{
|
|
||||||
environment: Belt.Map.String.toArray(ins.contents.environment),
|
|
||||||
exports: ex
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let inputsToLeaf = (inputs: Inputs.inputs) =>
|
let inputsToLeaf = (inputs: Inputs.inputs) =>
|
||||||
Parser.fromString(inputs.squiggleString) |> E.R.bind(_, g => runProgram(inputs, g))
|
Parser.fromString(inputs.squiggleString) |> E.R.bind(_, g => runProgram(inputs, g))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
let runAll : (string, Inputs.SamplingInputs.t, exportEnv) => result<exportType,string> =
|
let runAll: (string, Inputs.SamplingInputs.t, exportEnv) => result<exportType, string> = (
|
||||||
(squiggleString, samplingInputs, environment) => {
|
squiggleString,
|
||||||
|
samplingInputs,
|
||||||
|
environment,
|
||||||
|
) => {
|
||||||
let inputs = Inputs.make(
|
let inputs = Inputs.make(
|
||||||
~samplingInputs,
|
~samplingInputs,
|
||||||
~squiggleString,
|
~squiggleString,
|
||||||
|
|
|
@ -5,5 +5,6 @@ module Extra = Reducer_Extra
|
||||||
module Js = Reducer_Js
|
module Js = Reducer_Js
|
||||||
module MathJs = Reducer_MathJs
|
module MathJs = Reducer_MathJs
|
||||||
|
|
||||||
let eval = Expression.eval
|
type expressionValue = Reducer_Expression.expressionValue
|
||||||
|
let evaluate = Expression.eval
|
||||||
let parse = Expression.parse
|
let parse = Expression.parse
|
||||||
|
|
|
@ -4,5 +4,10 @@ module Expression = Reducer_Expression
|
||||||
module Extra = Reducer_Extra
|
module Extra = Reducer_Extra
|
||||||
module Js = Reducer_Js
|
module Js = Reducer_Js
|
||||||
module MathJs = Reducer_MathJs
|
module MathJs = Reducer_MathJs
|
||||||
let eval: string => result<Expression.expressionValue, ErrorValue.errorValue>
|
|
||||||
|
@genType
|
||||||
|
type expressionValue = Reducer_Expression.expressionValue
|
||||||
|
|
||||||
|
@genType
|
||||||
|
let evaluate: string => result<expressionValue, Reducer_ErrorValue.errorValue>
|
||||||
let parse: string => result<Expression.expression, ErrorValue.errorValue>
|
let parse: string => result<Expression.expression, ErrorValue.errorValue>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
@genType
|
||||||
type errorValue =
|
type errorValue =
|
||||||
| REArrayIndexNotFound(string, int)
|
| REArrayIndexNotFound(string, int)
|
||||||
| REFunctionExpected(string)
|
| REFunctionExpected(string)
|
||||||
|
@ -7,6 +8,7 @@ type errorValue =
|
||||||
|
|
||||||
type t = errorValue
|
type t = errorValue
|
||||||
|
|
||||||
|
@genType
|
||||||
let errorToString = err =>
|
let errorToString = err =>
|
||||||
switch err {
|
switch err {
|
||||||
| REArrayIndexNotFound(msg, index) => `${msg}: ${Js.String.make(index)}`
|
| REArrayIndexNotFound(msg, index) => `${msg}: ${Js.String.make(index)}`
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
module Result = Belt.Result
|
module Result = Belt.Result
|
||||||
module T = Reducer_Expression_T
|
module T = Reducer_Expression_T
|
||||||
type expression = T.expression
|
type expression = T.expression
|
||||||
type expressionValue = ReducerInterface.ExpressionValue.expressionValue
|
@genType
|
||||||
|
type expressionValue = ReducerInterface_ExpressionValue.expressionValue
|
||||||
type t = expression
|
type t = expression
|
||||||
let toString: T.expression => Js.String.t
|
let toString: T.expression => Js.String.t
|
||||||
let toStringResult: result<T.expression, 'a> => string
|
let toStringResult: result<T.expression, 'a> => string
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
module Extra_Array = Reducer_Extra_Array
|
module Extra_Array = Reducer_Extra_Array
|
||||||
module ErrorValue = Reducer_ErrorValue
|
module ErrorValue = Reducer_ErrorValue
|
||||||
|
|
||||||
|
@genType
|
||||||
type rec expressionValue =
|
type rec expressionValue =
|
||||||
| EvBool(bool)
|
| EvBool(bool)
|
||||||
| EvNumber(float)
|
| EvNumber(float)
|
||||||
|
|
|
@ -8,20 +8,49 @@ The below few seem to work fine. In the future there's definitely more work to d
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type env = DistributionOperation.env
|
type samplingParams = DistributionOperation.env
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type genericDist = GenericDist_Types.genericDist
|
type genericDist = GenericDist_Types.genericDist
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type error = GenericDist_Types.error
|
type distributionError = GenericDist_Types.error
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type resultDist = result<genericDist, error>
|
type resultDist = result<genericDist, distributionError>
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type resultFloat = result<float, error>
|
type resultFloat = result<float, distributionError>
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
type resultString = result<string, error>
|
type resultString = result<string, distributionError>
|
||||||
|
|
||||||
@genType
|
@genType
|
||||||
let makeSampleSetDist = SampleSetDist.make
|
let makeSampleSetDist = SampleSetDist.make
|
||||||
|
|
||||||
|
@genType
|
||||||
|
let evaluate = Reducer.evaluate
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type expressionValue = Reducer_Expression.expressionValue
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type errorValue = Reducer_ErrorValue.errorValue
|
||||||
|
|
||||||
|
@genType
|
||||||
|
let toPointSet = GenericDist.toPointSet
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type mixedShape = PointSetTypes.mixedShape
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type discreteShape = PointSetTypes.discreteShape
|
||||||
|
|
||||||
|
@genType
|
||||||
|
type continuousShape = PointSetTypes.continuousShape
|
||||||
|
|
||||||
|
@genType
|
||||||
|
let errorValueToString = Reducer_ErrorValue.errorToString
|
||||||
|
|
||||||
|
@genType
|
||||||
|
let distributionErrorToString = GenericDist_Types.Error.toString
|
||||||
|
|
1
packages/squiggle-lang/src/rescript/shims/Js.shim.ts
Normal file
1
packages/squiggle-lang/src/rescript/shims/Js.shim.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export type Dict_t<T> = { [key: string]: T };
|
|
@ -7,6 +7,7 @@
|
||||||
"removeComments": true,
|
"removeComments": true,
|
||||||
"preserveConstEnums": true,
|
"preserveConstEnums": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
"strict": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"declarationDir": "./dist",
|
"declarationDir": "./dist",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
.docusaurus
|
|
|
@ -6,7 +6,9 @@
|
||||||
"start": "docusaurus start",
|
"start": "docusaurus start",
|
||||||
"build": "docusaurus build",
|
"build": "docusaurus build",
|
||||||
"clean": "docusaurus clear",
|
"clean": "docusaurus clear",
|
||||||
"all": "yarn build"
|
"all": "yarn build",
|
||||||
|
"lint": "prettier --check .",
|
||||||
|
"format": "prettier --write ."
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "2.0.0-beta.18",
|
"@docusaurus/core": "2.0.0-beta.18",
|
||||||
|
|
253
yarn.lock
253
yarn.lock
|
@ -1394,9 +1394,9 @@
|
||||||
postcss-value-parser "^4.2.0"
|
postcss-value-parser "^4.2.0"
|
||||||
|
|
||||||
"@ctrl/tinycolor@^3.4.0":
|
"@ctrl/tinycolor@^3.4.0":
|
||||||
version "3.4.0"
|
version "3.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.4.0.tgz#c3c5ae543c897caa9c2a68630bed355be5f9990f"
|
resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.4.1.tgz#75b4c27948c81e88ccd3a8902047bcd797f38d32"
|
||||||
integrity sha512-JZButFdZ1+/xAfpguQHoabIXkcqRRKpMrWKBkpEZZyxfY9C1DpADFB8PEqGSTeFr135SaTRfKqGKx5xSCLI7ZQ==
|
integrity sha512-ej5oVy6lykXsvieQtqZxCOaLT+xD4+QNarq78cIYISHmZXshCvROLudpQN3lfL8G0NL7plMSSK+zlyvCaIJ4Iw==
|
||||||
|
|
||||||
"@discoveryjs/json-ext@^0.5.0", "@discoveryjs/json-ext@^0.5.3":
|
"@discoveryjs/json-ext@^0.5.0", "@discoveryjs/json-ext@^0.5.3":
|
||||||
version "0.5.7"
|
version "0.5.7"
|
||||||
|
@ -3629,19 +3629,19 @@
|
||||||
lodash "^4.17.15"
|
lodash "^4.17.15"
|
||||||
redent "^3.0.0"
|
redent "^3.0.0"
|
||||||
|
|
||||||
"@testing-library/react@^13.0.0":
|
"@testing-library/react@^13.0.1":
|
||||||
version "13.0.0"
|
version "13.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-13.0.0.tgz#8cdaf4667c6c2b082eb0513731551e9db784e8bc"
|
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-13.0.1.tgz#00d223e182923d341a9610590561fb9dd1324110"
|
||||||
integrity sha512-p0lYA1M7uoEmk2LnCbZLGmHJHyH59sAaZVXChTXlyhV/PRW9LoIh4mdf7tiXsO8BoNG+vN8UnFJff1hbZeXv+w==
|
integrity sha512-zeHx3PohYYp+4bTJwrixQY8zSBZjWUGwYc7OhD1EpWTHS92RleApLoP72NdwaWxOrM1P1Uezt3XvGf6t2XSWPQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
"@testing-library/dom" "^8.5.0"
|
"@testing-library/dom" "^8.5.0"
|
||||||
"@types/react-dom" "*"
|
"@types/react-dom" "^18.0.0"
|
||||||
|
|
||||||
"@testing-library/user-event@^14.0.4":
|
"@testing-library/user-event@^14.0.4":
|
||||||
version "14.0.4"
|
version "14.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.0.4.tgz#5b430a9c27f25078bff4471661b755115d0db9d4"
|
resolved "https://registry.yarnpkg.com/@testing-library/user-event/-/user-event-14.1.0.tgz#db479c06271b72a4d41cf595ec2ad7ff078c1d72"
|
||||||
integrity sha512-VBZe5lcUsmrQyOwIFvqOxLBoaTw1/Qy4Ek+VgmFYs719bs2SxUp42vbsb7ATlQDkHdj4OIQlucfpwxe5WoG1jA==
|
integrity sha512-+CGfMXlVM+OwREHDEsfTGsXIMI+rjr3a7YBUSutq7soELht+8kQrM5k46xa/WLfHdtX/wqsDIleL6bi4i+xz0w==
|
||||||
|
|
||||||
"@tootallnate/once@1":
|
"@tootallnate/once@1":
|
||||||
version "1.1.2"
|
version "1.1.2"
|
||||||
|
@ -3985,7 +3985,7 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
|
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc"
|
||||||
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
|
integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==
|
||||||
|
|
||||||
"@types/react-dom@*", "@types/react-dom@^18.0.0":
|
"@types/react-dom@^18.0.0":
|
||||||
version "18.0.0"
|
version "18.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.0.tgz#b13f8d098e4b0c45df4f1ed123833143b0c71141"
|
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.0.0.tgz#b13f8d098e4b0c45df4f1ed123833143b0c71141"
|
||||||
integrity sha512-49897Y0UiCGmxZqpC8Blrf6meL8QUla6eb+BBhn69dTXlmuOlzkfr7HHY/O8J25e1lTUMs+YYxSlVDAaGHCOLg==
|
integrity sha512-49897Y0UiCGmxZqpC8Blrf6meL8QUla6eb+BBhn69dTXlmuOlzkfr7HHY/O8J25e1lTUMs+YYxSlVDAaGHCOLg==
|
||||||
|
@ -4025,28 +4025,10 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/react" "*"
|
"@types/react" "*"
|
||||||
|
|
||||||
"@types/react@*":
|
"@types/react@*", "@types/react@^16.9.19", "@types/react@^18.0.1":
|
||||||
version "17.0.44"
|
version "18.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.44.tgz#c3714bd34dd551ab20b8015d9d0dbec812a51ec7"
|
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.2.tgz#bc6a0572d434642ebe8b4ac0f121d18e2f2d8f7f"
|
||||||
integrity sha512-Ye0nlw09GeMp2Suh8qoOv0odfgCoowfM/9MG6WeRD60Gq9wS90bdkdRtYbRkNhXOpG4H+YXGvj4wOWhAC0LJ1g==
|
integrity sha512-2poV9ReTwwV5ZNxkKyk7t6Vp/odeTfYI3vRjtDYWfUdEstx9mp26jzELfMBwV6gXg1irhHUnmZJH/dJW7xafcA==
|
||||||
dependencies:
|
|
||||||
"@types/prop-types" "*"
|
|
||||||
"@types/scheduler" "*"
|
|
||||||
csstype "^3.0.2"
|
|
||||||
|
|
||||||
"@types/react@^16.9.19":
|
|
||||||
version "16.14.24"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.24.tgz#f2c5e9fa78f83f769884b83defcf7924b9eb5c82"
|
|
||||||
integrity sha512-e7U2WC8XQP/xfR7bwhOhNFZKPTfW1ph+MiqtudKb8tSV8RyCsovQx2sNVtKoOryjxFKpHPPC/yNiGfdeVM5Gyw==
|
|
||||||
dependencies:
|
|
||||||
"@types/prop-types" "*"
|
|
||||||
"@types/scheduler" "*"
|
|
||||||
csstype "^3.0.2"
|
|
||||||
|
|
||||||
"@types/react@^18.0.1":
|
|
||||||
version "18.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.1.tgz#1b2e02fb7613212518733946e49fb963dfc66e19"
|
|
||||||
integrity sha512-VnWlrVgG0dYt+NqlfMI0yUYb8Rdl4XUROyH+c6gq/iFCiZ805Vi//26UW38DHnxQkbDhnrIWTBiy6oKZqL11cw==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/prop-types" "*"
|
"@types/prop-types" "*"
|
||||||
"@types/scheduler" "*"
|
"@types/scheduler" "*"
|
||||||
|
@ -4199,13 +4181,13 @@
|
||||||
"@types/yargs-parser" "*"
|
"@types/yargs-parser" "*"
|
||||||
|
|
||||||
"@typescript-eslint/eslint-plugin@^5.5.0":
|
"@typescript-eslint/eslint-plugin@^5.5.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.18.0.tgz#950df411cec65f90d75d6320a03b2c98f6c3af7d"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.19.0.tgz#9608a4b6d0427104bccf132f058cba629a6553c0"
|
||||||
integrity sha512-tzrmdGMJI/uii9/V6lurMo4/o+dMTKDH82LkNjhJ3adCW22YQydoRs5MwTiqxGF9CSYxPxQ7EYb4jLNlIs+E+A==
|
integrity sha512-w59GpFqDYGnWFim9p6TGJz7a3qWeENJuAKCqjGSx+Hq/bwq3RZwXYqy98KIfN85yDqz9mq6QXiY5h0FjGQLyEg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/scope-manager" "5.18.0"
|
"@typescript-eslint/scope-manager" "5.19.0"
|
||||||
"@typescript-eslint/type-utils" "5.18.0"
|
"@typescript-eslint/type-utils" "5.19.0"
|
||||||
"@typescript-eslint/utils" "5.18.0"
|
"@typescript-eslint/utils" "5.19.0"
|
||||||
debug "^4.3.2"
|
debug "^4.3.2"
|
||||||
functional-red-black-tree "^1.0.1"
|
functional-red-black-tree "^1.0.1"
|
||||||
ignore "^5.1.8"
|
ignore "^5.1.8"
|
||||||
|
@ -4214,75 +4196,75 @@
|
||||||
tsutils "^3.21.0"
|
tsutils "^3.21.0"
|
||||||
|
|
||||||
"@typescript-eslint/experimental-utils@^5.0.0":
|
"@typescript-eslint/experimental-utils@^5.0.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.18.0.tgz#a6b5662e6b0452cb0e75a13662ce3b33cd1be59d"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.19.0.tgz#b7c8f1e22624d4f3d1b3683438530f5636086cb7"
|
||||||
integrity sha512-hypiw5N0aM2aH91/uMmG7RpyUH3PN/iOhilMwkMFZIbm/Bn/G3ZnbaYdSoAN4PG/XHQjdhBYLi0ZoRZsRYT4hA==
|
integrity sha512-F+X/TTzmb2UXbghY1LrNLNDjMcGZMhKzXuzvu0xD+YEB77EamLM7zMOLuz2kP5807IJRDLBoAFFPYa7HT62sYg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/utils" "5.18.0"
|
"@typescript-eslint/utils" "5.19.0"
|
||||||
|
|
||||||
"@typescript-eslint/parser@^5.5.0":
|
"@typescript-eslint/parser@^5.5.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.18.0.tgz#2bcd4ff21df33621df33e942ccb21cb897f004c6"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.19.0.tgz#05e587c1492868929b931afa0cb5579b0f728e75"
|
||||||
integrity sha512-+08nYfurBzSSPndngnHvFw/fniWYJ5ymOrn/63oMIbgomVQOvIDhBoJmYZ9lwQOCnQV9xHGvf88ze3jFGUYooQ==
|
integrity sha512-yhktJjMCJX8BSBczh1F/uY8wGRYrBeyn84kH6oyqdIJwTGKmzX5Qiq49LRQ0Jh0LXnWijEziSo6BRqny8nqLVQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/scope-manager" "5.18.0"
|
"@typescript-eslint/scope-manager" "5.19.0"
|
||||||
"@typescript-eslint/types" "5.18.0"
|
"@typescript-eslint/types" "5.19.0"
|
||||||
"@typescript-eslint/typescript-estree" "5.18.0"
|
"@typescript-eslint/typescript-estree" "5.19.0"
|
||||||
debug "^4.3.2"
|
debug "^4.3.2"
|
||||||
|
|
||||||
"@typescript-eslint/scope-manager@5.18.0":
|
"@typescript-eslint/scope-manager@5.19.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.18.0.tgz#a7d7b49b973ba8cebf2a3710eefd457ef2fb5505"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.19.0.tgz#97e59b0bcbcb54dbcdfba96fc103b9020bbe9cb4"
|
||||||
integrity sha512-C0CZML6NyRDj+ZbMqh9FnPscg2PrzSaVQg3IpTmpe0NURMVBXlghGZgMYqBw07YW73i0MCqSDqv2SbywnCS8jQ==
|
integrity sha512-Fz+VrjLmwq5fbQn5W7cIJZ066HxLMKvDEmf4eu1tZ8O956aoX45jAuBB76miAECMTODyUxH61AQM7q4/GOMQ5g==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types" "5.18.0"
|
"@typescript-eslint/types" "5.19.0"
|
||||||
"@typescript-eslint/visitor-keys" "5.18.0"
|
"@typescript-eslint/visitor-keys" "5.19.0"
|
||||||
|
|
||||||
"@typescript-eslint/type-utils@5.18.0":
|
"@typescript-eslint/type-utils@5.19.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.18.0.tgz#62dbfc8478abf36ba94a90ddf10be3cc8e471c74"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.19.0.tgz#80f2125b0dfe82494bbae1ea99f1c0186d420282"
|
||||||
integrity sha512-vcn9/6J5D6jtHxpEJrgK8FhaM8r6J1/ZiNu70ZUJN554Y3D9t3iovi6u7JF8l/e7FcBIxeuTEidZDR70UuCIfA==
|
integrity sha512-O6XQ4RI4rQcBGshTQAYBUIGsKqrKeuIOz9v8bckXZnSeXjn/1+BDZndHLe10UplQeJLXDNbaZYrAytKNQO2T4Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/utils" "5.18.0"
|
"@typescript-eslint/utils" "5.19.0"
|
||||||
debug "^4.3.2"
|
debug "^4.3.2"
|
||||||
tsutils "^3.21.0"
|
tsutils "^3.21.0"
|
||||||
|
|
||||||
"@typescript-eslint/types@5.18.0":
|
"@typescript-eslint/types@5.19.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.18.0.tgz#4f0425d85fdb863071680983853c59a62ce9566e"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.19.0.tgz#12d3d600d754259da771806ee8b2c842d3be8d12"
|
||||||
integrity sha512-bhV1+XjM+9bHMTmXi46p1Led5NP6iqQcsOxgx7fvk6gGiV48c6IynY0apQb7693twJDsXiVzNXTflhplmaiJaw==
|
integrity sha512-zR1ithF4Iyq1wLwkDcT+qFnhs8L5VUtjgac212ftiOP/ZZUOCuuF2DeGiZZGQXGoHA50OreZqLH5NjDcDqn34w==
|
||||||
|
|
||||||
"@typescript-eslint/typescript-estree@5.18.0":
|
"@typescript-eslint/typescript-estree@5.19.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.18.0.tgz#6498e5ee69a32e82b6e18689e2f72e4060986474"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.19.0.tgz#fc987b8f62883f9ea6a5b488bdbcd20d33c0025f"
|
||||||
integrity sha512-wa+2VAhOPpZs1bVij9e5gyVu60ReMi/KuOx4LKjGx2Y3XTNUDJgQ+5f77D49pHtqef/klglf+mibuHs9TrPxdQ==
|
integrity sha512-dRPuD4ocXdaE1BM/dNR21elSEUPKaWgowCA0bqJ6YbYkvtrPVEvZ+zqcX5a8ECYn3q5iBSSUcBBD42ubaOp0Hw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types" "5.18.0"
|
"@typescript-eslint/types" "5.19.0"
|
||||||
"@typescript-eslint/visitor-keys" "5.18.0"
|
"@typescript-eslint/visitor-keys" "5.19.0"
|
||||||
debug "^4.3.2"
|
debug "^4.3.2"
|
||||||
globby "^11.0.4"
|
globby "^11.0.4"
|
||||||
is-glob "^4.0.3"
|
is-glob "^4.0.3"
|
||||||
semver "^7.3.5"
|
semver "^7.3.5"
|
||||||
tsutils "^3.21.0"
|
tsutils "^3.21.0"
|
||||||
|
|
||||||
"@typescript-eslint/utils@5.18.0", "@typescript-eslint/utils@^5.13.0":
|
"@typescript-eslint/utils@5.19.0", "@typescript-eslint/utils@^5.13.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.18.0.tgz#27fc84cf95c1a96def0aae31684cb43a37e76855"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.19.0.tgz#fe87f1e3003d9973ec361ed10d36b4342f1ded1e"
|
||||||
integrity sha512-+hFGWUMMri7OFY26TsOlGa+zgjEy1ssEipxpLjtl4wSll8zy85x0GrUSju/FHdKfVorZPYJLkF3I4XPtnCTewA==
|
integrity sha512-ZuEckdupXpXamKvFz/Ql8YnePh2ZWcwz7APICzJL985Rp5C2AYcHO62oJzIqNhAMtMK6XvrlBTZeNG8n7gS3lQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/json-schema" "^7.0.9"
|
"@types/json-schema" "^7.0.9"
|
||||||
"@typescript-eslint/scope-manager" "5.18.0"
|
"@typescript-eslint/scope-manager" "5.19.0"
|
||||||
"@typescript-eslint/types" "5.18.0"
|
"@typescript-eslint/types" "5.19.0"
|
||||||
"@typescript-eslint/typescript-estree" "5.18.0"
|
"@typescript-eslint/typescript-estree" "5.19.0"
|
||||||
eslint-scope "^5.1.1"
|
eslint-scope "^5.1.1"
|
||||||
eslint-utils "^3.0.0"
|
eslint-utils "^3.0.0"
|
||||||
|
|
||||||
"@typescript-eslint/visitor-keys@5.18.0":
|
"@typescript-eslint/visitor-keys@5.19.0":
|
||||||
version "5.18.0"
|
version "5.19.0"
|
||||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.18.0.tgz#c7c07709823804171d569017f3b031ced7253e60"
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.19.0.tgz#c84ebc7f6c744707a361ca5ec7f7f64cd85b8af6"
|
||||||
integrity sha512-Hf+t+dJsjAKpKSkg3EHvbtEpFFb/1CiOHnvI8bjHgOD4/wAw3gKrA0i94LrbekypiZVanJu3McWJg7rWDMzRTg==
|
integrity sha512-Ym7zZoMDZcAKWsULi2s7UMLREdVQdScPQ/fKWMYefarCztWlHPFVJo8racf8R0Gc8FAEJ2eD4of8As1oFtnQlQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/types" "5.18.0"
|
"@typescript-eslint/types" "5.19.0"
|
||||||
eslint-visitor-keys "^3.0.0"
|
eslint-visitor-keys "^3.0.0"
|
||||||
|
|
||||||
"@webassemblyjs/ast@1.11.1":
|
"@webassemblyjs/ast@1.11.1":
|
||||||
|
@ -5037,22 +5019,24 @@ array-unique@^0.3.2:
|
||||||
integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=
|
integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=
|
||||||
|
|
||||||
array.prototype.flat@^1.2.1, array.prototype.flat@^1.2.5:
|
array.prototype.flat@^1.2.1, array.prototype.flat@^1.2.5:
|
||||||
version "1.2.5"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz#07e0975d84bbc7c48cd1879d609e682598d33e13"
|
resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.0.tgz#0b0c1567bf57b38b56b4c97b8aa72ab45e4adc7b"
|
||||||
integrity sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==
|
integrity sha512-12IUEkHsAhA4DY5s0FPgNXIdc8VRSqD9Zp78a5au9abH/SOBrsp082JOWFNTjkMozh8mqcdiKuaLGhPeYztxSw==
|
||||||
dependencies:
|
dependencies:
|
||||||
call-bind "^1.0.2"
|
call-bind "^1.0.2"
|
||||||
define-properties "^1.1.3"
|
define-properties "^1.1.3"
|
||||||
es-abstract "^1.19.0"
|
es-abstract "^1.19.2"
|
||||||
|
es-shim-unscopables "^1.0.0"
|
||||||
|
|
||||||
array.prototype.flatmap@^1.2.1, array.prototype.flatmap@^1.2.5:
|
array.prototype.flatmap@^1.2.1, array.prototype.flatmap@^1.2.5:
|
||||||
version "1.2.5"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.5.tgz#908dc82d8a406930fdf38598d51e7411d18d4446"
|
resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz#a7e8ed4225f4788a70cd910abcf0791e76a5534f"
|
||||||
integrity sha512-08u6rVyi1Lj7oqWbS9nUxliETrtIROT4XGTA4D/LWGten6E3ocm7cy9SIrmNHOL5XVbVuckUp3X6Xyg8/zpvHA==
|
integrity sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg==
|
||||||
dependencies:
|
dependencies:
|
||||||
call-bind "^1.0.0"
|
call-bind "^1.0.2"
|
||||||
define-properties "^1.1.3"
|
define-properties "^1.1.3"
|
||||||
es-abstract "^1.19.0"
|
es-abstract "^1.19.2"
|
||||||
|
es-shim-unscopables "^1.0.0"
|
||||||
|
|
||||||
array.prototype.map@^1.0.4:
|
array.prototype.map@^1.0.4:
|
||||||
version "1.0.4"
|
version "1.0.4"
|
||||||
|
@ -5975,9 +5959,9 @@ caniuse-api@^3.0.0:
|
||||||
lodash.uniq "^4.5.0"
|
lodash.uniq "^4.5.0"
|
||||||
|
|
||||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001317:
|
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001317:
|
||||||
version "1.0.30001327"
|
version "1.0.30001328"
|
||||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001327.tgz#c1546d7d7bb66506f0ccdad6a7d07fc6d668c858"
|
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001328.tgz#0ed7a2ca65ec45872c613630201644237ba1e329"
|
||||||
integrity sha512-1/Cg4jlD9qjZzhbzkzEaAC2JHsP0WrOc8Rd/3a3LuajGzGWR/hD7TVyvq99VqmTy99eVh8Zkmdq213OgvgXx7w==
|
integrity sha512-Ue55jHkR/s4r00FLNiX+hGMMuwml/QGqqzVeMQ5thUewznU2EdULFvI3JR7JJid6OrjJNfFvHY2G2dIjmRaDDQ==
|
||||||
|
|
||||||
capture-exit@^2.0.0:
|
capture-exit@^2.0.0:
|
||||||
version "2.0.0"
|
version "2.0.0"
|
||||||
|
@ -7041,9 +7025,9 @@ cyclist@^1.0.1:
|
||||||
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
|
integrity sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=
|
||||||
|
|
||||||
"d3-array@1 - 3", "d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@^3.1.1:
|
"d3-array@1 - 3", "d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@^3.1.1:
|
||||||
version "3.1.5"
|
version "3.1.6"
|
||||||
resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.1.5.tgz#ba8a09fc50aee6c02c3ca2a97c485b9ce68a8e34"
|
resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-3.1.6.tgz#0342c835925826f49b4d16eb7027aec334ffc97d"
|
||||||
integrity sha512-Rs6syGyepVjAYXWvhiFiVWUM8l4B/0p33tvlS+eXCVOaFrbz1dU7t+T16SJx/frnaLMXmFmKoXg/5aUVXxmMKQ==
|
integrity sha512-DCbBBNuKOeiR9h04ySRBMW52TFVc91O9wJziuyXw6Ztmy8D3oZbmCkOO3UHKC7ceNJsN2Mavo9+vwV8EAEUXzA==
|
||||||
dependencies:
|
dependencies:
|
||||||
internmap "1 - 2"
|
internmap "1 - 2"
|
||||||
|
|
||||||
|
@ -7683,9 +7667,9 @@ ejs@^3.1.6:
|
||||||
jake "^10.6.1"
|
jake "^10.6.1"
|
||||||
|
|
||||||
electron-to-chromium@^1.4.84:
|
electron-to-chromium@^1.4.84:
|
||||||
version "1.4.106"
|
version "1.4.107"
|
||||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.106.tgz#e7a3bfa9d745dd9b9e597616cb17283cc349781a"
|
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.107.tgz#564257014ab14033b4403a309c813123c58a3fb9"
|
||||||
integrity sha512-ZYfpVLULm67K7CaaGP7DmjyeMY4naxsbTy+syVVxT6QHI1Ww8XbJjmr9fDckrhq44WzCrcC5kH3zGpdusxwwqg==
|
integrity sha512-Huen6taaVrUrSy8o7mGStByba8PfOWWluHNxSHGBrCgEdFVLtvdQDBr9LBCF9Uci8SYxh28QNNMO0oC17wbGAg==
|
||||||
|
|
||||||
element-resize-detector@^1.2.2:
|
element-resize-detector@^1.2.2:
|
||||||
version "1.2.4"
|
version "1.2.4"
|
||||||
|
@ -7820,10 +7804,10 @@ error-stack-parser@^2.0.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
stackframe "^1.1.1"
|
stackframe "^1.1.1"
|
||||||
|
|
||||||
es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1:
|
es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2:
|
||||||
version "1.19.2"
|
version "1.19.3"
|
||||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.2.tgz#8f7b696d8f15b167ae3640b4060670f3d054143f"
|
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.3.tgz#4dd9da55868192756c83c5c30c7878d04e77125d"
|
||||||
integrity sha512-gfSBJoZdlL2xRiOCy0g8gLMryhoe1TlimjzU99L/31Z8QEGIhVQI+EWwt5lT+AuU9SnorVupXFqqOGqGfsyO6w==
|
integrity sha512-4axXLNovnMYf0+csS5rVnS5hLmV1ek+ecx9MuCjByL1E5Nn54avf6CHQxIjgQIHBnfX9AMxTRIy0q+Yu5J/fXA==
|
||||||
dependencies:
|
dependencies:
|
||||||
call-bind "^1.0.2"
|
call-bind "^1.0.2"
|
||||||
es-to-primitive "^1.2.1"
|
es-to-primitive "^1.2.1"
|
||||||
|
@ -7836,7 +7820,7 @@ es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1:
|
||||||
is-callable "^1.2.4"
|
is-callable "^1.2.4"
|
||||||
is-negative-zero "^2.0.2"
|
is-negative-zero "^2.0.2"
|
||||||
is-regex "^1.1.4"
|
is-regex "^1.1.4"
|
||||||
is-shared-array-buffer "^1.0.1"
|
is-shared-array-buffer "^1.0.2"
|
||||||
is-string "^1.0.7"
|
is-string "^1.0.7"
|
||||||
is-weakref "^1.0.2"
|
is-weakref "^1.0.2"
|
||||||
object-inspect "^1.12.0"
|
object-inspect "^1.12.0"
|
||||||
|
@ -7870,6 +7854,13 @@ es-module-lexer@^0.9.0:
|
||||||
resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19"
|
resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19"
|
||||||
integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==
|
integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==
|
||||||
|
|
||||||
|
es-shim-unscopables@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241"
|
||||||
|
integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==
|
||||||
|
dependencies:
|
||||||
|
has "^1.0.3"
|
||||||
|
|
||||||
es-to-primitive@^1.2.1:
|
es-to-primitive@^1.2.1:
|
||||||
version "1.2.1"
|
version "1.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a"
|
resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a"
|
||||||
|
@ -8050,9 +8041,9 @@ eslint-plugin-react@^7.27.1:
|
||||||
string.prototype.matchall "^4.0.6"
|
string.prototype.matchall "^4.0.6"
|
||||||
|
|
||||||
eslint-plugin-testing-library@^5.0.1:
|
eslint-plugin-testing-library@^5.0.1:
|
||||||
version "5.2.1"
|
version "5.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.2.1.tgz#3f89cd28ade81329a11584e0bbea129bede01619"
|
resolved "https://registry.yarnpkg.com/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.3.0.tgz#1f5a58827fefc240e1ec1bac706de4c24f5de7be"
|
||||||
integrity sha512-88qJv6uzYALtiYJDzhelP3ov0Px/GLgnu+UekjjDxL2nMyvgdTyboKqcDBsvFPmAeizlCoSWOjeBN4DxO0BxaA==
|
integrity sha512-DpQmduNYNQamIz/rz2haCOlJVIVi8gZ8mpDCCX7IMWMK436HMpepXafHhdUZxdRoaAkziLSJosRg6bqGAFqT3w==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@typescript-eslint/utils" "^5.13.0"
|
"@typescript-eslint/utils" "^5.13.0"
|
||||||
|
|
||||||
|
@ -10126,7 +10117,7 @@ is-set@^2.0.2:
|
||||||
resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec"
|
resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec"
|
||||||
integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==
|
integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==
|
||||||
|
|
||||||
is-shared-array-buffer@^1.0.1:
|
is-shared-array-buffer@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79"
|
resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79"
|
||||||
integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==
|
integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==
|
||||||
|
@ -11929,9 +11920,9 @@ node-libs-browser@^2.2.1:
|
||||||
vm-browserify "^1.0.1"
|
vm-browserify "^1.0.1"
|
||||||
|
|
||||||
node-releases@^2.0.2:
|
node-releases@^2.0.2:
|
||||||
version "2.0.2"
|
version "2.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.2.tgz#7139fe71e2f4f11b47d4d2986aaf8c48699e0c01"
|
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.3.tgz#225ee7488e4a5e636da8da52854844f9d716ca96"
|
||||||
integrity sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg==
|
integrity sha512-maHFz6OLqYxz+VQyCAtA3PTX4UP/53pa05fyDNc9CwjvJ0yEh6+xBwKsgCxMNhS8taUKBFYxfuiaD9U/55iFaw==
|
||||||
|
|
||||||
normalize-package-data@^2.5.0:
|
normalize-package-data@^2.5.0:
|
||||||
version "2.5.0"
|
version "2.5.0"
|
||||||
|
@ -13796,9 +13787,9 @@ rc-pagination@~3.1.9:
|
||||||
classnames "^2.2.1"
|
classnames "^2.2.1"
|
||||||
|
|
||||||
rc-picker@~2.6.4:
|
rc-picker@~2.6.4:
|
||||||
version "2.6.5"
|
version "2.6.6"
|
||||||
resolved "https://registry.yarnpkg.com/rc-picker/-/rc-picker-2.6.5.tgz#a7cf8eb0723ec81e379c784c4b798b7fe076dd8c"
|
resolved "https://registry.yarnpkg.com/rc-picker/-/rc-picker-2.6.6.tgz#2ac71924c748f66c01a179038469f5018f450cfb"
|
||||||
integrity sha512-4pcg0PgEz4YXBfdwMuHIKaRWaADm3k3g0NtoPIgeGM+VVeOBdUowTx0YSXnT8mQEXcE9lWXX+ZX3biAzQwDM1w==
|
integrity sha512-fLyvTRF9Vaa6ftBF6VTWztYbuhNDh0+k9GOeJBD/TFrYleqWEmDs27/WHlCTE6R15/nQLryofvS31cNPSpD+OA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.10.1"
|
"@babel/runtime" "^7.10.1"
|
||||||
classnames "^2.2.1"
|
classnames "^2.2.1"
|
||||||
|
@ -13851,9 +13842,9 @@ rc-select@~14.0.0-alpha.23, rc-select@~14.0.0-alpha.8, rc-select@~14.0.2:
|
||||||
rc-virtual-list "^3.2.0"
|
rc-virtual-list "^3.2.0"
|
||||||
|
|
||||||
rc-slider@~10.0.0-alpha.4:
|
rc-slider@~10.0.0-alpha.4:
|
||||||
version "10.0.0-alpha.6"
|
version "10.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/rc-slider/-/rc-slider-10.0.0-alpha.6.tgz#d1f0098a2044a0063c912d049a1309e3357404d6"
|
resolved "https://registry.yarnpkg.com/rc-slider/-/rc-slider-10.0.0.tgz#8ffe1dd3c8799c9d1f81ac808976f18af3dca206"
|
||||||
integrity sha512-4tMChJ3lzX0qlttcXqJ2xecQ+CmZYPXJGDOvPnIS5YWsiSl452vt377/l8A1ZnwjwKAAy2V6nrOXNdqPP2Tq7w==
|
integrity sha512-Bk54UIKWW4wyhHcL8ehAxt+wX+n69dscnHTX6Uv0FMxSke/TGrlkZz1LSIWblCpfE2zr/dwR2Ca8nZGk3U+Tbg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.10.1"
|
"@babel/runtime" "^7.10.1"
|
||||||
classnames "^2.2.5"
|
classnames "^2.2.5"
|
||||||
|
@ -13944,9 +13935,9 @@ rc-tree@~5.4.3:
|
||||||
rc-virtual-list "^3.4.2"
|
rc-virtual-list "^3.4.2"
|
||||||
|
|
||||||
rc-trigger@^5.0.0, rc-trigger@^5.0.4, rc-trigger@^5.1.2, rc-trigger@^5.2.10:
|
rc-trigger@^5.0.0, rc-trigger@^5.0.4, rc-trigger@^5.1.2, rc-trigger@^5.2.10:
|
||||||
version "5.2.12"
|
version "5.2.15"
|
||||||
resolved "https://registry.yarnpkg.com/rc-trigger/-/rc-trigger-5.2.12.tgz#023728bf2e31a3bdd07bdca016e0991aae98e504"
|
resolved "https://registry.yarnpkg.com/rc-trigger/-/rc-trigger-5.2.15.tgz#f6bfed418e602513cc3e07853ddaf37e5c5339f4"
|
||||||
integrity sha512-+rymZRe23f2imQwuelWqWSKj3tAnlDbjEU8yjKzW5zh8AlChJ/brda7Qg3FQ4f2jcAquL7phVOwq5BZp2PdhAg==
|
integrity sha512-VxZWqCObtUOzs9V9Be0dDA2JGchriDpvQaJpsCI2EQ4+KWHIvjFz6Ziina4uxK5drRsn0RnBi7nngmTl9j/F7Q==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.11.2"
|
"@babel/runtime" "^7.11.2"
|
||||||
classnames "^2.2.6"
|
classnames "^2.2.6"
|
||||||
|
@ -13964,9 +13955,9 @@ rc-upload@~4.3.0:
|
||||||
rc-util "^5.2.0"
|
rc-util "^5.2.0"
|
||||||
|
|
||||||
rc-util@^5.0.1, rc-util@^5.0.6, rc-util@^5.12.0, rc-util@^5.14.0, rc-util@^5.15.0, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.18.1, rc-util@^5.19.2, rc-util@^5.19.3, rc-util@^5.2.0, rc-util@^5.2.1, rc-util@^5.3.0, rc-util@^5.4.0, rc-util@^5.5.0, rc-util@^5.6.1, rc-util@^5.7.0, rc-util@^5.8.0, rc-util@^5.9.4, rc-util@^5.9.8:
|
rc-util@^5.0.1, rc-util@^5.0.6, rc-util@^5.12.0, rc-util@^5.14.0, rc-util@^5.15.0, rc-util@^5.16.1, rc-util@^5.17.0, rc-util@^5.18.1, rc-util@^5.19.2, rc-util@^5.19.3, rc-util@^5.2.0, rc-util@^5.2.1, rc-util@^5.3.0, rc-util@^5.4.0, rc-util@^5.5.0, rc-util@^5.6.1, rc-util@^5.7.0, rc-util@^5.8.0, rc-util@^5.9.4, rc-util@^5.9.8:
|
||||||
version "5.19.6"
|
version "5.20.0"
|
||||||
resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-5.19.6.tgz#76d714fd116d22bc5fd7421939589e27c1dfad19"
|
resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-5.20.0.tgz#05915902313292cb3f0e8da9401a403be00c3f58"
|
||||||
integrity sha512-/xJ8UtpbuJj7+2ftxVQM6gUzLY+Towq4iB6sP6/2hhn6mwWNLij2I+1qOkLv75I1jqWKpS+gU8A2EmbfLtGxNg==
|
integrity sha512-sHm129TjpUiJZuHCgX5moead5yag4ukIIZuwkK1SSlFMUceEx64sZNgJZJN7YQ9NJyDpabfJ8310fkcCXeyTog==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
react-is "^16.12.0"
|
react-is "^16.12.0"
|
||||||
|
@ -14123,9 +14114,9 @@ react-fast-compare@^3.0.1, react-fast-compare@^3.2.0:
|
||||||
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
|
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
|
||||||
|
|
||||||
react-helmet-async@*, react-helmet-async@^1.0.7, react-helmet-async@^1.2.3:
|
react-helmet-async@*, react-helmet-async@^1.0.7, react-helmet-async@^1.2.3:
|
||||||
version "1.2.3"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.2.3.tgz#57326a69304ea3293036eafb49475e9ba454cb37"
|
resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.3.0.tgz#7bd5bf8c5c69ea9f02f6083f14ce33ef545c222e"
|
||||||
integrity sha512-mCk2silF53Tq/YaYdkl2sB+/tDoPnaxN7dFS/6ZLJb/rhUY2EWGI5Xj2b4jHppScMqY45MbgPSwTxDchKpZ5Kw==
|
integrity sha512-9jZ57/dAn9t3q6hneQS0wukqC2ENOBgMNVEhb/ZG9ZSxUetzVIw4iAmEU38IaVg3QGYauQPhSeUTuIUtFglWpg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.12.5"
|
"@babel/runtime" "^7.12.5"
|
||||||
invariant "^2.2.4"
|
invariant "^2.2.4"
|
||||||
|
@ -17086,9 +17077,9 @@ vega-transforms@~4.10.0:
|
||||||
vega-util "^1.16.1"
|
vega-util "^1.16.1"
|
||||||
|
|
||||||
vega-typings@~0.22.0:
|
vega-typings@~0.22.0:
|
||||||
version "0.22.2"
|
version "0.22.3"
|
||||||
resolved "https://registry.yarnpkg.com/vega-typings/-/vega-typings-0.22.2.tgz#c5f5037680778664f5246c19a56e4cfffeb0d90b"
|
resolved "https://registry.yarnpkg.com/vega-typings/-/vega-typings-0.22.3.tgz#f6c73b5ffcdb152539cfcc5ad240a413af579ba7"
|
||||||
integrity sha512-op4bNiyS150V7gnuIdjwFYB1belYB8qnapqLQQ+ZBJQ+r7a+IbvXphEUf8AkBlOoGPN1ITNdhlIsq9WWiuxu8Q==
|
integrity sha512-PREcya3nXT9Tk7xU0IhEpOLVTlqizNtKXV55NhI6ApBjJtqVYbJL7IBh2ckKxGBy3YeUQ37BQZl56UqqiYVWBw==
|
||||||
dependencies:
|
dependencies:
|
||||||
vega-event-selector "^3.0.0"
|
vega-event-selector "^3.0.0"
|
||||||
vega-expression "^5.0.0"
|
vega-expression "^5.0.0"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user