Giter Site home page Giter Site logo

purescm / purescript-effect Goto Github PK

View Code? Open in Web Editor NEW

This project forked from purescript/purescript-effect

0.0 0.0 1.0 76 KB

The Effect monad, for handling native side effects

License: BSD 3-Clause "New" or "Revised" License

JavaScript 27.19% PureScript 72.81%

purescript-effect's Introduction

purescm - Chez Scheme backend for PureScript

Installation

Install requisites:

  • chezscheme - you should have the scheme command available in your $PATH.
  • libpcre2 - purescm has a runtime dependency on the 16-bit variant of pcre2. Check your package manager for pcre2 or pcre2-16 or similar.

You can install purescm with npm:

npm i --global purescm

Usage

The best way to use purescm is to use the spago integration for alternative PureScript backends. In spago.yaml use the backend config like so:

workspace:
  backend:
    cmd: purescm
    args:
      - "build"

Then to compile your purescm project you can run:

spago build

This will produce output under output/. You can run the compiled program with:

purescm run

Bundling

Scheme files can be precompiled to a single Chez program:

purescm bundle-app

which generates a single file output/main which can be run with scheme or petite:

scheme --program output/main

Development

Running the tests

To run all tests, run npm run test. This will run both the scheme runtime unit tests and the snapshot tests.

To overwrite old snapshots with the latest output, run npm run test -- -a "--accept". To add a new snapshot, create a file called Snapshot.X.purs where X indicates what is being tested. If a snapshot needs a dependency, install it by running cd test-snapshots && spago install <packages...>.

Vendored Dependencies

In order to represent Array and record types in purescm, the backend has a runtime dependency on implementation of SRFI 214 (Flexvectors). This is due in part to how vectors are more like "arrays" than "array lists".

We vendor chez-srfi using the following steps:

  1. Clone chez-srfi at the project root.

  2. Navigate to chez-srfi and run ./install.chezscheme.sps ../vendor. This should produce an srfi folder inside of vendor.

  3. Copy the desired SRFIs from vendor/srfi into vendor/purs/runtime/srfi. Make sure to also copy the SRFIs and other scheme files (e.g. the ones in the private folder) that they depend on. The library-requirements function can aid in this process.

  4. Modify the copied scheme files such that the library names align with the folder structure. sd makes this easy!

sd "\(srfi " "(purs runtime srfi " vendor/purs/**/*.sls
  1. To verify, simply invoke the Scheme REPL:
$ scheme --libdirs ./vendor:
Chez Scheme Version 9.5.8
Copyright 1984-2022 Cisco Systems, Inc.

> (import (purs runtime srfi :125))
>

purescript-effect's People

Contributors

garyb avatar hdgarrood avatar jordanmartinez avatar kl0tl avatar kritzcreek avatar liamgoodacre avatar masaeedu avatar matthewleon avatar mhmdanas avatar milesfrain avatar paf31 avatar paldepind avatar thomashoneyman avatar xuwei-k avatar

Watchers

 avatar

Forkers

postsolar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.