Skip to content
This repository has been archived by the owner on Dec 18, 2020. It is now read-only.

Commit

Permalink
Updates for RC
Browse files Browse the repository at this point in the history
  • Loading branch information
garyb committed Jun 9, 2015
1 parent 9d360c2 commit db0b186
Show file tree
Hide file tree
Showing 13 changed files with 249 additions and 105 deletions.
4 changes: 3 additions & 1 deletion .gitignore
@@ -1,6 +1,8 @@
/.*
!/.gitignore
!/.jscsrc
!/.jshintrc
!/.travis.yml
/bower_components/
/node_modules/
/output/
/tmp/
12 changes: 12 additions & 0 deletions .jscsrc
@@ -0,0 +1,12 @@
{
"preset": "grunt",
"disallowSpacesInAnonymousFunctionExpression": null,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInsideObjectBrackets": null,
"requireSpacesInsideObjectBrackets": "all",
"validateQuoteMarks": "\"",
"requireCurlyBraces": null
}
19 changes: 19 additions & 0 deletions .jshintrc
@@ -0,0 +1,19 @@
{
"bitwise": true,
"eqeqeq": true,
"forin": true,
"freeze": true,
"funcscope": true,
"futurehostile": true,
"globalstrict": true,
"latedef": true,
"maxparams": 1,
"noarg": true,
"nocomma": true,
"nonew": true,
"notypeof": true,
"singleGroups": true,
"undef": true,
"unused": true,
"eqnull": true
}
14 changes: 14 additions & 0 deletions .travis.yml
@@ -0,0 +1,14 @@
language: node_js
node_js:
- 0.10
env:
- PATH=$HOME/purescript:$PATH
install:
- 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')
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
- chmod a+x $HOME/purescript
- npm install bower gulp -g
- npm install && bower install
script:
- gulp
35 changes: 0 additions & 35 deletions Gruntfile.js

This file was deleted.

54 changes: 7 additions & 47 deletions README.md
@@ -1,55 +1,15 @@
# Module Documentation
# purescript-globals

## Module Global
[![Build Status](https://travis-ci.org/purescript/purescript-globals.svg?branch=master)](https://travis-ci.org/purescript/purescript-globals)

Typed definitions for standard Javascript globals.

This module defines types for some global Javascript functions
and values.
## Installation

#### `nan`

``` purescript
nan :: Number
```

Not a number (NaN)

#### `isNaN`

``` purescript
isNaN :: Number -> Boolean
```

Test whether a number is NaN

#### `infinity`

``` purescript
infinity :: Number
bower install purescript-globals
```

Positive infinity

#### `isFinite`

``` purescript
isFinite :: Number -> Boolean
```

Test whether a number is finite

#### `readInt`

``` purescript
readInt :: Number -> String -> Number
```

Parse an integer from a `String` in the specified base

#### `readFloat`

``` purescript
readFloat :: String -> Number
```
## Module documentation

Parse a floating point value from a `String`
- [Global](docs/Global.md)
15 changes: 11 additions & 4 deletions bower.json
Expand Up @@ -6,15 +6,22 @@
"purescript"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/purescript/purescript-globals.git"
},
"ignore": [
"**/.*",
"bower_components",
"node_modules",
"output",
"tests",
"tmp",
"test",
"bower.json",
"Gruntfile.js",
"gulpfile.js",
"package.json"
]
],
"devDependencies": {
"purescript-assert": "^0.1.0",
"purescript-console": "^0.1.0"
}
}
54 changes: 54 additions & 0 deletions docs/Global.md
@@ -0,0 +1,54 @@
## Module Global

This module defines types for some global Javascript functions
and values.

#### `nan`

``` purescript
nan :: Number
```

Not a number (NaN)

#### `isNaN`

``` purescript
isNaN :: Number -> Boolean
```

Test whether a number is NaN

#### `infinity`

``` purescript
infinity :: Number
```

Positive infinity

#### `isFinite`

``` purescript
isFinite :: Number -> Boolean
```

Test whether a number is finite

#### `readInt`

``` purescript
readInt :: Int -> String -> Number
```

Parse an integer from a `String` in the specified base

#### `readFloat`

``` purescript
readFloat :: String -> Number
```

Parse a floating point value from a `String`


70 changes: 70 additions & 0 deletions gulpfile.js
@@ -0,0 +1,70 @@
/* jshint node: true */
"use strict";

var gulp = require("gulp");
var jshint = require("gulp-jshint");
var jscs = require("gulp-jscs");
var plumber = require("gulp-plumber");
var purescript = require("gulp-purescript");
var rimraf = require("rimraf");
var run = require("gulp-run");

var sources = [
"src/**/*.purs",
"test/**/*.purs",
"bower_components/purescript-*/src/**/*.purs"
];

var foreigns = [
"src/**/*.js",
"test/**/*.js",
"bower_components/purescript-*/src/**/*.js"
];

gulp.task("clean-docs", function (cb) {
rimraf("docs", cb);
});

gulp.task("clean-output", function (cb) {
rimraf("output", cb);
});

gulp.task("clean", ["clean-docs", "clean-output"]);

gulp.task("lint", function() {
return gulp.src("src/**/*.js")
.pipe(jshint())
.pipe(jshint.reporter())
.pipe(jscs());
});

gulp.task("make", ["lint"], function() {
return gulp.src(sources)
.pipe(plumber())
.pipe(purescript.pscMake({ ffi: foreigns }));
});

gulp.task("docs", ["clean-docs"], function () {
return gulp.src(sources)
.pipe(plumber())
.pipe(purescript.pscDocs({
docgen: {
"Global": "docs/Global.md"
}
}));
});

gulp.task("dotpsci", function () {
return gulp.src(sources)
.pipe(plumber())
.pipe(purescript.dotPsci());
});

gulp.task("test", ["make"], function() {
return gulp.src(sources.concat(["test/**/*.purs"]))
.pipe(plumber())
.pipe(purescript.psc({ main: "Test.Main", ffi: foreigns }))
.pipe(run("node"));
});

gulp.task("default", ["make", "docs", "dotpsci", "test"]);
12 changes: 8 additions & 4 deletions package.json
@@ -1,8 +1,12 @@
{
"private": true,
"dependencies": {
"grunt": "~0.4.4",
"grunt-purescript": "~0.6.0",
"grunt-contrib-clean": "~0.5.0"
"devDependencies": {
"gulp": "^3.8.11",
"gulp-jscs": "^1.6.0",
"gulp-jshint": "^1.10.0",
"gulp-plumber": "^1.0.0",
"gulp-purescript": "^0.5.0-rc.1",
"gulp-run": "~1.6.7",
"rimraf": "^2.3.3"
}
}
14 changes: 11 additions & 3 deletions src/Global.js
@@ -1,12 +1,20 @@
/* globals exports */
"use strict";

// module Global

exports.nan = NaN;

exports.isNaN = isNaN;

exports.infinity = Infinity;

exports.readInt = function(radix) {
return function(n) {
exports.isFinite = isFinite;

exports.readInt = function (radix) {
return function (n) {
return parseInt(n, radix);
};
};

exports.readFloat = parseFloat;

13 changes: 2 additions & 11 deletions src/Global.purs
@@ -1,14 +1,6 @@
-- | This module defines types for some global Javascript functions
-- | and values.

module Global
( nan
, isNaN
, infinity
, isFinite
, readInt
, readFloat
) where
module Global where

-- | Not a number (NaN)
foreign import nan :: Number
Expand All @@ -23,8 +15,7 @@ foreign import infinity :: Number
foreign import isFinite :: Number -> Boolean

-- | Parse an integer from a `String` in the specified base
foreign import readInt :: Number -> String -> Number
foreign import readInt :: Int -> String -> Number

-- | Parse a floating point value from a `String`
foreign import readFloat :: String -> Number

0 comments on commit db0b186

Please sign in to comment.