Skip to content

Commit

Permalink
Run CI on push / pull_request to master
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashoneyman committed Dec 8, 2020
1 parent d241760 commit 9330054
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: CI

on: push
on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
Expand Down
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Latest release](http://img.shields.io/github/release/purescript/purescript-effect.svg)](https://github.com/purescript/purescript-effect/releases)
[![Build status](https://github.com/purescript/purescript-effect/workflows/CI/badge.svg?branch=master)](https://github.com/purescript/purescript-effect/actions?query=workflow%3ACI+branch%3Amaster)
[![Pursuit](https://pursuit.purescript.org/packages/purescript-effect/badge)](https://pursuit.purescript.org/packages/purescript-effect)

The `Effect` monad, for handling native side effects.

Expand All @@ -18,17 +19,17 @@ the standard type PureScript uses to handle "native" effects, i.e. effects
which are provided by the runtime system, and which cannot be emulated by pure
functions. Some examples of native effects are:

* Console IO
* Random number generation
* Exceptions
* Reading/writing mutable state
- Console IO
- Random number generation
- Exceptions
- Reading/writing mutable state

And in the browser:

* DOM manipulation
* XMLHttpRequest / AJAX calls
* Interacting with a websocket
* Writing/reading to/from local storage
- DOM manipulation
- XMLHttpRequest / AJAX calls
- Interacting with a websocket
- Writing/reading to/from local storage

All of these things may be represented in PureScript by the `Effect` type.
A value of the type `Effect a` represents a computation which may perform
Expand Down Expand Up @@ -122,12 +123,12 @@ and in the corresponding JavaScript module:

```javascript
// Counter.js
exports.incrCounter = function() {
exports.incrCounter = function () {
if (!window.globalCounter) {
window.globalCounter = 0;
}
return ++window.globalCounter;
}
};
```

For more information about the FFI (Foreign Function Interface), see
Expand All @@ -149,16 +150,19 @@ compiler produces the following JavaScript:

```javascript
var printRandom = function __do() {
var $0 = Effect_Random.random();
return Effect_Console.log(Data_Show.show(Data_Show.showNumber)($0))();
var $0 = Effect_Random.random();
return Effect_Console.log(Data_Show.show(Data_Show.showNumber)($0))();
};
```

whereas a more naive compiler might, for instance, produce:

```javascript
var printRandom = Control_Bind.bind(Effect.bindEffect)(Effect_Random.random)(function ($0) {
var printRandom = Control_Bind.bind(Effect.bindEffect)(Effect_Random.random)(
function ($0) {
return Effect_Console.log(Data_Show.show(Data_Show.showNumber)($0));
});
}
);
```

While this is a small improvement, the benefit is greater when using
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"build": "eslint src && pulp build -- --censor-lib --strict"
},
"devDependencies": {
"eslint": "^4.19.1",
"eslint": "^7.15.0",
"pulp": "^15.0.0",
"purescript-psa": "^0.8.0",
"rimraf": "^2.6.2"
"rimraf": "^3.0.2"
}
}

0 comments on commit 9330054

Please sign in to comment.