Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit ce2fa05

Browse files
committed
Merge pull request #11 from purescript/0.8-updates
Updates for PureScript 0.8
2 parents 2c81248 + 5843d72 commit ce2fa05

File tree

15 files changed

+93
-203
lines changed

15 files changed

+93
-203
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
/bower_components/
77
/node_modules/
88
/output/
9-
/tmp/

.jscsrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"preset": "grunt",
3+
"disallowSpacesInFunctionExpression": null,
4+
"requireSpacesInFunctionExpression": {
5+
"beforeOpeningRoundBrace": true,
6+
"beforeOpeningCurlyBrace": true
7+
},
38
"disallowSpacesInAnonymousFunctionExpression": null,
49
"requireSpacesInAnonymousFunctionExpression": {
510
"beforeOpeningRoundBrace": true,

.jshintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"freeze": true,
66
"funcscope": true,
77
"futurehostile": true,
8-
"globalstrict": true,
8+
"strict": "global",
99
"latedef": true,
1010
"maxparams": 1,
1111
"noarg": true,
@@ -15,5 +15,6 @@
1515
"singleGroups": true,
1616
"undef": true,
1717
"unused": true,
18-
"eqnull": true
18+
"eqnull": true,
19+
"predef": ["exports"]
1920
}

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
language: node_js
22
sudo: false
33
node_js:
4-
- 0.10
4+
- 5
55
env:
66
- PATH=$HOME/purescript:$PATH
77
install:
88
- TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p')
99
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
1010
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
1111
- chmod a+x $HOME/purescript
12+
- npm install -g bower
1213
- npm install
1314
script:
1415
- npm run build
16+
after_success:
17+
- >-
18+
test $TRAVIS_TAG &&
19+
psc-publish > .pursuit.json &&
20+
curl -X POST http://pursuit.purescript.org/packages \
21+
-d @.pursuit.json \
22+
-H 'Accept: application/json' \
23+
-H "Authorization: token ${GITHUB_TOKEN}"

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44
[![Build Status](https://travis-ci.org/purescript/purescript-eff.svg?branch=master)](https://travis-ci.org/purescript/purescript-eff)
55
[![Dependency Status](https://www.versioneye.com/user/projects/55848cde3638610015000408/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55848cde3638610015000408)
66

7-
The `Eff` monad, for handling native side effects. For use with compiler version >= 0.7.
7+
The `Eff` monad, for handling native side effects.
88

99
## Installation
1010

1111
```
1212
bower install purescript-eff
1313
```
1414

15-
## Module documentation
15+
## Documentation
1616

17-
- [Control.Monad.Eff](docs/Control/Monad/Eff.md)
18-
- [Control.Monad.Eff.Unsafe](docs/Control/Monad/Eff/Unsafe.md)
19-
- [Control.Monad.Eff.Class](docs/Control/Monad/Eff/Class.md)
17+
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-eff).

bower.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"name": "purescript-eff",
33
"homepage": "https://github.com/purescript/purescript-eff",
44
"description": "The Eff monad, for handling native side effects",
5-
"keywords": [
6-
"purescript"
7-
],
85
"license": "MIT",
96
"repository": {
107
"type": "git",
@@ -17,10 +14,9 @@
1714
"output",
1815
"test",
1916
"bower.json",
20-
"gulpfile.js",
2117
"package.json"
2218
],
2319
"dependencies": {
24-
"purescript-prelude": "^0.1.0"
20+
"purescript-prelude": "^1.0.0-rc.1"
2521
}
2622
}

docs/Control/Monad/Eff.md

Lines changed: 0 additions & 85 deletions
This file was deleted.

docs/Control/Monad/Eff/Class.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/Control/Monad/Eff/Unsafe.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"private": true,
33
"scripts": {
44
"postinstall": "pulp dep install",
5-
"build": "jshint src && jscs src && pulp build && rimraf docs && pulp docs"
5+
"clean": "rimraf output && rimraf .pulp-cache",
6+
"build": "jshint src && jscs src && pulp build"
67
},
78
"devDependencies": {
8-
"jscs": "^1.13.1",
9-
"jshint": "^2.8.0",
10-
"pulp": "^4.0.1",
11-
"rimraf": "^2.4.1"
9+
"jscs": "^2.8.0",
10+
"jshint": "^2.9.1",
11+
"pulp": "^8.0.0",
12+
"rimraf": "^2.5.0"
1213
}
1314
}

src/Control/Monad/Eff.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
/* global exports */
21
"use strict";
32

43
// module Control.Monad.Eff
54

6-
exports.returnE = function (a) {
5+
exports.pureE = function (a) {
76
return function () {
87
return a;
98
};

src/Control/Monad/Eff.purs

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,77 @@
11
module Control.Monad.Eff
2-
( Eff()
3-
, Pure()
2+
( Eff
3+
, Pure
44
, runPure
55
, untilE, whileE, forE, foreachE
66
) where
77

8-
import Prelude
8+
import Control.Applicative (class Applicative, liftA1)
9+
import Control.Apply (class Apply)
10+
import Control.Bind (class Bind)
11+
import Control.Monad (class Monad, ap)
12+
13+
import Data.Functor (class Functor)
14+
import Data.Unit (Unit)
915

1016
-- | The `Eff` type constructor is used to represent _native_ effects.
1117
-- |
12-
-- | See [Handling Native Effects with the Eff Monad](http://www.purescript.org/learn/eff/) for more details.
18+
-- | See [Handling Native Effects with the Eff Monad](http://www.purescript.org/learn/eff/)
19+
-- | for more details.
1320
-- |
14-
-- | The first type parameter is a row of effects which represents the contexts in which a computation can be run, and the second type parameter is the return type.
21+
-- | The first type parameter is a row of effects which represents the contexts
22+
-- | in which a computation can be run, and the second type parameter is the
23+
-- | return type.
1524
foreign import data Eff :: # ! -> * -> *
1625

17-
foreign import returnE :: forall e a. a -> Eff e a
18-
19-
foreign import bindE :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
20-
21-
-- | The `Pure` type synonym represents _pure_ computations, i.e. ones in which all effects have been handled.
22-
-- |
23-
-- | The `runPure` function can be used to run pure computations and obtain their result.
24-
type Pure a = Eff () a
25-
26-
-- | Run a pure computation and return its result.
27-
foreign import runPure :: forall a. Pure a -> a
28-
2926
instance functorEff :: Functor (Eff e) where
3027
map = liftA1
3128

3229
instance applyEff :: Apply (Eff e) where
3330
apply = ap
3431

3532
instance applicativeEff :: Applicative (Eff e) where
36-
pure = returnE
33+
pure = pureE
34+
35+
foreign import pureE :: forall e a. a -> Eff e a
3736

3837
instance bindEff :: Bind (Eff e) where
3938
bind = bindE
4039

40+
foreign import bindE :: forall e a b. Eff e a -> (a -> Eff e b) -> Eff e b
41+
4142
instance monadEff :: Monad (Eff e)
4243

44+
-- | The `Pure` type synonym represents _pure_ computations, i.e. ones in which
45+
-- | all effects have been handled.
46+
-- |
47+
-- | The `runPure` function can be used to run pure computations and obtain
48+
-- | their result.
49+
type Pure a = Eff () a
50+
51+
-- | Run a pure computation and return its result.
52+
foreign import runPure :: forall a. Pure a -> a
53+
4354
-- | Loop until a condition becomes `true`.
4455
-- |
45-
-- | `untilE b` is an effectful computation which repeatedly runs the effectful computation `b`,
46-
-- | until its return value is `true`.
56+
-- | `untilE b` is an effectful computation which repeatedly runs the effectful
57+
-- | computation `b`, until its return value is `true`.
4758
foreign import untilE :: forall e. Eff e Boolean -> Eff e Unit
4859

4960
-- | Loop while a condition is `true`.
5061
-- |
51-
-- | `whileE b m` is effectful computation which runs the effectful computation `b`. If its result is
52-
-- | `true`, it runs the effectful computation `m` and loops. If not, the computation ends.
62+
-- | `whileE b m` is effectful computation which runs the effectful computation
63+
-- | `b`. If its result is `true`, it runs the effectful computation `m` and
64+
-- | loops. If not, the computation ends.
5365
foreign import whileE :: forall e a. Eff e Boolean -> Eff e a -> Eff e Unit
5466

5567
-- | Loop over a consecutive collection of numbers.
5668
-- |
57-
-- | `forE lo hi f` runs the computation returned by the function `f` for each of the inputs
58-
-- | between `lo` (inclusive) and `hi` (exclusive).
59-
foreign import forE :: forall e. Number -> Number -> (Number -> Eff e Unit) -> Eff e Unit
69+
-- | `forE lo hi f` runs the computation returned by the function `f` for each
70+
-- | of the inputs between `lo` (inclusive) and `hi` (exclusive).
71+
foreign import forE :: forall e. Int -> Int -> (Int -> Eff e Unit) -> Eff e Unit
6072

6173
-- | Loop over an array of values.
6274
-- |
63-
-- | `foreach xs f` runs the computation returned by the function `f` for each of the inputs `xs`.
75+
-- | `foreach xs f` runs the computation returned by the function `f` for each
76+
-- | of the inputs `xs`.
6477
foreign import foreachE :: forall e a. Array a -> (a -> Eff e Unit) -> Eff e Unit

0 commit comments

Comments
 (0)