{"id":13547304,"url":"https://github.com/purescript/trypurescript","last_synced_at":"2026-01-27T02:03:06.023Z","repository":{"id":11601138,"uuid":"14093432","full_name":"purescript/trypurescript","owner":"purescript","description":"PureScript in the browser","archived":false,"fork":false,"pushed_at":"2024-09-03T21:35:59.000Z","size":6638,"stargazers_count":120,"open_issues_count":29,"forks_count":50,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-10-29T00:42:16.687Z","etag":null,"topics":["purescript"],"latest_commit_sha":null,"homepage":"https://try.purescript.org","language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/purescript.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-11-03T20:57:10.000Z","updated_at":"2025-08-25T16:27:20.000Z","dependencies_parsed_at":"2023-12-25T08:02:34.015Z","dependency_job_id":"74dc4e26-bf19-4c36-ad77-ab427db95132","html_url":"https://github.com/purescript/trypurescript","commit_stats":{"total_commits":338,"total_committers":31,"mean_commits":"10.903225806451612","dds":0.5443786982248521,"last_synced_commit":"c41dfbc6e53bc23ea6f3d8a973c425da820a4de3"},"previous_names":[],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/purescript/trypurescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Ftrypurescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Ftrypurescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Ftrypurescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Ftrypurescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purescript","download_url":"https://codeload.github.com/purescript/trypurescript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purescript%2Ftrypurescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28796962,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T01:07:07.743Z","status":"online","status_checked_at":"2026-01-27T02:00:07.755Z","response_time":168,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["purescript"],"created_at":"2024-08-01T12:00:53.651Z","updated_at":"2026-01-27T02:03:06.004Z","avatar_url":"https://github.com/purescript.png","language":"PureScript","readme":"# Try PureScript\n\n[![Build Status](https://github.com/purescript/trypurescript/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/trypurescript/actions?query=workflow%3ACI+branch%3Amaster)\n\n[Try PureScript](https://try.purescript.org) is an online PureScript code editor for quickly experimenting with PureScript code snippets and ideas. It consists of a client and a server component, both of which live within this repository.\n\n## Features:\n\n- Writing code using the [Ace Editor](http://ace.c9.io)\n- Automatic compilation\n- PureScript syntax highlighting\n- Run and print output or show resulting JavaScript\n- Multiple view modes: code, output or both\n- Shareable code and editor state via URL\n- Load PureScript code from GitHub Gists or repository files\n\n### Control Features via the Query String\n\nMost of these features can be controlled not only from the toolbar, but also using the [query parameters](https://en.wikipedia.org/wiki/Query_string):\n\n- **Load From GitHub Repo**: Load a PureScript file from a GitHub repository using the `github` parameter\n    - Format: `github=/\u003cowner\u003e/\u003crepo\u003e/\u003cbranch or tag\u003e/\u003cfile\u003e.purs`\n    - Example: `github=/purescript/trypurescript/master/client/examples/Main.purs`.\n    - Notes: the file should be a single PureScript module with the module name `Main`.\n\n- **Load From Gist**: Load PureScript code from a gist using the `gist` parameter\n    - Format: `gist=\u003cgist id\u003e`\n    - Example: `gist=37c3c97f47a43f20c548`\n    - Notes: the file should be named `Main.purs` with the module name `Main`.\n\n- **Load From URL**: Load compressed PureScript code using the `code` parameter\n    - Managed by Try PureScript and updated on editor state change to create shareable URLs\n    - Format: `code=\u003ccompressed string\u003e`\n    - Example: `code=LYewJgrgNgpgBAWQIYEsB2cDuALGAnGIA` will set the editor state to the single line `module Main where`\n\n- **View Mode**: Control the view mode using the `view` parameter\n    - Options are: `code`, `output`, `both` (default)\n    - Example: `view=output` will only display the output\n\n- **Auto Compile**: Automatic compilation can be turned off using the `compile` parameter\n    - Options are: `true` (default), `false`\n    - Example: `compile=false` will turn auto compilation off\n\n- **JavaScript Code Generation**: Print the resulting JavaScript code in the output window instead of the output of the program using the `js` parameter\n    - Options are: `true`, `false` (default)\n    - Example: `js=true` will print JavaScript code instead of the program's output\n\n### Which Libraries Are Available?\n\nTry PureScript aims to provide a complete, recent package set from \u003chttps://github.com/purescript/package-sets\u003e. The available libraries are those listed in [`staging/spago.dhall`](./staging/spago.dhall), at the versions in the package set mentioned in [`staging/packages.dhall`](./staging/packages.dhall).\n\n## Development\n\n### 1. Shared setup\n\nThese steps should be performed whether you are working on the server, the client, or both.\n\n```sh\n# Clone into the repository\ngit clone git@github.com:purescript/trypurescript.git\ncd trypurescript\n```\n\n### 2. Local compile server setup\n\nThis step sets up a local server for Try PureScript. You can skip this step if you just want to use the client with the production server.\n\n```sh\n# Build the trypurescript executable\nstack build\n\n# Set up the PureScript environment for the server\ncd staging\nspago build\n\n# Ensure the compiled JavaScript is available to the client via symbolic link.\nln -s \"$PWD/output\" \"$PWD/../client/public/js/output\"\n\n# Then, start the server.\n#\n# Below, we disable glob expansion via `set -o noglob` to ensure that globs are\n# passed to `purs` unchanged.\n#\n# We run this in a subshell so that setting noglob only lasts for the duration\n# of the command and no longer.\n(set -o noglob \u0026\u0026 stack exec trypurescript 8081 $(spago sources))\n\n# Should output that it is compiling the sources (first time)\n# Then: Setting phasers to stun... (port 8081) (ctrl-c to quit)\n```\n\n### 3. Client setup\n\n```sh\n# Install development dependencies\ncd client\nnpm install\n\n# Use `serve:dev` if you are using a local Try PureScript server,\n# e.g. you followed the instructions in step 1.\n#\n# Use `serve:production` if you would like\n# to test the client against the production Try PureScript server.\n# Note: the production server may not match the package set you have locally.\nnpm run serve:(dev|production)\n\n# Try PureScript is now available on localhost:8080\n```\n\n### 4. Choosing a Tag\n\nThe built-in examples for Try PureScript are loaded from this GitHub repository. To change the tag that the examples are loaded from, you'll need to touch three files:\n\n* `client/config/dev/Try.Config.purs`\n* `client/config/prod/Try.Config.purs`\n* `client/examples/Main.purs`, in the `fromExample` function.\n\nIf you are preparing a release or if you need to adjust examples in development, you should change the tag in these three places (and ensure you're using the same tag in each place!).\n\n## Server API\n\nThe server is a very basic web service which wraps the PureScript compiler, allowing clients to send PureScript code to be compiled and receiving either compiled JS or error messages in response.\nIt is hosted at \u003chttps://compile.purescript.org/\u003e.\n\n### Compile PureScript code\n\n#### POST /compile\n\n- Request body: PureScript code defining a module whose name must be Main\n- Status code: 200 (success)\n\nResponse body on compilation success:\n\n```javascript\n{\n  \"js\": \"...\", // a string containing JavaScript code\n  \"warnings\": [ ... ] // an array of warnings, using the same format as the\n                      // compiler's --json-errors flag\n}\n```\n\nResponse body on compilation failure:\n\n```javascript\n{\n  \"error\": {\n    \"tag\": \"CompilerErrors\",\n    \"contents\": [ ... ] // an array of errors, using the same format as the\n                        // compiler's --json-errors flag\n  }\n}\n```\n\nResponse body on other errors (eg, the name of the module in request body was not Main, or the request body was too large)\n\n```javascript\n{\n  \"error\": {\n    \"tag\": \"OtherError\",\n    \"contents\": \"...\" // a string containing an error message\n  }\n}\n```\n\nNote that the API returns a 200 response in all of the above cases; in particular, if the code in the request body fails to compile and the API returns errors, this is still considered a success.\nAmong other things, this makes it easier to use the API from another domain using CORS.\n\nThe output code will contain references to any imported modules using `require` calls.\nTo run these files in the browser, it is necessary to either use a `require` shim (such as require1k), or replace these calls and deploy a bundle of precompiled modules.\nThe Try PureScript client uses the first approach.\n\n#### GET /output/:module/(index.js|foreign.js)\n\nThe server exposes the compiled JS for all of the modules it has access to.\nIf the compiled JavaScript code in the response includes a `require` call such as `require(../Web.HTML/index.js)`, then the client is expected to arrange things so that this `require` call provides access to the JavaScript code available at the URL path `/output/Web.HTML/index.js`, via a shim or otherwise.\n\n### Configuration\n\nThe server application takes the following arguments on the command line:\n\n- port number\n- a list of input source files\n\n#### Example\n\n    trypurescript 8081 'bower_components/purescript-*/src/**/*.purs'\n","funding_links":[],"categories":["PureScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript%2Ftrypurescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurescript%2Ftrypurescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurescript%2Ftrypurescript/lists"}