Skip to content

Commit 0737506

Browse files
committed
Update dependencies, docs, build
1 parent 7834ce6 commit 0737506

File tree

8 files changed

+162
-109
lines changed

8 files changed

+162
-109
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.*
22
!/.gitignore
3+
!/.travis.yml
34
/bower_components/
45
/node_modules/
56
/output/

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: node_js
2+
node_js:
3+
- 0.10
4+
env:
5+
- PATH=$HOME/purescript:$PATH
6+
install:
7+
- 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')
8+
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
9+
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
10+
- chmod a+x $HOME/purescript
11+
- npm install bower gulp -g
12+
- npm install && bower install
13+
script:
14+
- gulp

Gruntfile.js

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

README.md

Lines changed: 7 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,15 @@
1-
# Module Documentation
1+
# purescript-exceptions
22

3-
## Module Control.Monad.Eff.Exception
3+
[![Build Status](https://travis-ci.org/purescript/purescript-exceptions.svg?branch=master)](https://travis-ci.org/purescript/purescript-exceptions)
44

5+
Exception effects.
56

6-
This module defines an effect, actions and handlers for working
7-
with Javascript exceptions.
7+
## Installation
88

9-
#### `Exception`
10-
11-
``` purescript
12-
data Exception :: !
13-
```
14-
15-
This effect is used to annotate code which possibly throws exceptions
16-
17-
#### `Error`
18-
19-
``` purescript
20-
data Error :: *
219
```
22-
23-
The type of Javascript errors
24-
25-
#### `showError`
26-
27-
``` purescript
28-
instance showError :: Show Error
10+
bower install purescript-exceptions
2911
```
3012

13+
## Module documentation
3114

32-
#### `error`
33-
34-
``` purescript
35-
error :: String -> Error
36-
```
37-
38-
Create a Javascript error, specifying a message
39-
40-
#### `message`
41-
42-
``` purescript
43-
message :: Error -> String
44-
```
45-
46-
Get the error message from a Javascript error
47-
48-
#### `throwException`
49-
50-
``` purescript
51-
throwException :: forall a eff. Error -> Eff (err :: Exception | eff) a
52-
```
53-
54-
Throw an exception
55-
56-
For example:
57-
58-
```purescript
59-
main = do
60-
x <- readNumber
61-
when (x < 0) $ throwException $
62-
error "Expected a non-negative number"
63-
```
64-
65-
#### `catchException`
66-
67-
``` purescript
68-
catchException :: forall a eff. (Error -> Eff eff a) -> Eff (err :: Exception | eff) a -> Eff eff a
69-
```
70-
71-
Catch an exception by providing an exception handler.
72-
73-
This handler removes the `Exception` effect.
74-
75-
For example:
76-
77-
```purescript
78-
main = catchException print do
79-
trace "Exceptions thrown in this block will be logged to the console"
80-
```
15+
- [Control.Monad.Eff.Exception](docs/Control.Monad.Eff.Exception.md)

bower.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
"bower_components",
1212
"node_modules",
1313
"output",
14-
"tests",
15-
"tmp",
1614
"bower.json",
1715
"Gruntfile.js",
1816
"package.json"
19-
]
17+
],
18+
"dependencies": {
19+
"purescript-eff": "~0.1.0"
20+
}
2021
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Module Documentation
2+
3+
## Module Control.Monad.Eff.Exception
4+
5+
6+
This module defines an effect, actions and handlers for working
7+
with Javascript exceptions.
8+
9+
#### `EXCEPTION`
10+
11+
``` purescript
12+
data EXCEPTION :: !
13+
```
14+
15+
This effect is used to annotate code which possibly throws exceptions
16+
17+
#### `Error`
18+
19+
``` purescript
20+
data Error :: *
21+
```
22+
23+
The type of Javascript errors
24+
25+
#### `showError`
26+
27+
``` purescript
28+
instance showError :: Show Error
29+
```
30+
31+
32+
#### `error`
33+
34+
``` purescript
35+
error :: String -> Error
36+
```
37+
38+
Create a Javascript error, specifying a message
39+
40+
#### `message`
41+
42+
``` purescript
43+
message :: Error -> String
44+
```
45+
46+
Get the error message from a Javascript error
47+
48+
#### `throwException`
49+
50+
``` purescript
51+
throwException :: forall a eff. Error -> Eff (err :: EXCEPTION | eff) a
52+
```
53+
54+
Throw an exception
55+
56+
For example:
57+
58+
```purescript
59+
main = do
60+
x <- readNumber
61+
when (x < 0) $ throwException $
62+
error "Expected a non-negative number"
63+
```
64+
65+
#### `catchException`
66+
67+
``` purescript
68+
catchException :: forall a eff. (Error -> Eff eff a) -> Eff (err :: EXCEPTION | eff) a -> Eff eff a
69+
```
70+
71+
Catch an exception by providing an exception handler.
72+
73+
This handler removes the `EXCEPTION` effect.
74+
75+
For example:
76+
77+
```purescript
78+
main = catchException print do
79+
trace "Exceptions thrown in this block will be logged to the console"
80+
```
81+
82+
83+

gulpfile.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
"use strict";
2+
3+
var gulp = require("gulp");
4+
var plumber = require("gulp-plumber");
5+
var purescript = require("gulp-purescript");
6+
var jsvalidate = require("gulp-jsvalidate");
7+
8+
var paths = [
9+
"src/**/*.purs",
10+
"bower_components/purescript-*/src/**/*.purs"
11+
];
12+
13+
gulp.task("make", function() {
14+
return gulp.src(paths)
15+
.pipe(plumber())
16+
.pipe(purescript.pscMake());
17+
});
18+
19+
gulp.task("jsvalidate", ["make"], function () {
20+
return gulp.src("output/**/*.js")
21+
.pipe(plumber())
22+
.pipe(jsvalidate());
23+
});
24+
25+
var docTasks = [];
26+
27+
var docTask = function(name) {
28+
var taskName = "docs-" + name.toLowerCase();
29+
gulp.task(taskName, function () {
30+
return gulp.src("src/" + name.replace(/\./g, "/") + ".purs")
31+
.pipe(plumber())
32+
.pipe(purescript.pscDocs())
33+
.pipe(gulp.dest("docs/" + name + ".md"));
34+
});
35+
docTasks.push(taskName);
36+
};
37+
38+
["Control.Monad.Eff.Exception"].forEach(docTask);
39+
40+
gulp.task("docs", docTasks);
41+
42+
gulp.task("dotpsci", function () {
43+
return gulp.src(paths)
44+
.pipe(plumber())
45+
.pipe(purescript.dotPsci());
46+
});
47+
48+
gulp.task("default", ["jsvalidate", "docs", "dotpsci"]);

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"private": true,
3-
"dependencies": {
4-
"grunt": "~0.4.4",
5-
"grunt-purescript": "~0.5.1",
6-
"grunt-contrib-clean": "~0.5.0"
3+
"devDependencies": {
4+
"gulp": "^3.8.11",
5+
"gulp-jsvalidate": "^1.0.1",
6+
"gulp-plumber": "^1.0.0",
7+
"gulp-purescript": "^0.3.1"
78
}
89
}

0 commit comments

Comments
 (0)