diff --git a/.jscsrc b/.jscsrc index 342da66..2561ce9 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,5 +1,10 @@ { "preset": "grunt", + "disallowSpacesInFunctionExpression": null, + "requireSpacesInFunctionExpression": { + "beforeOpeningRoundBrace": true, + "beforeOpeningCurlyBrace": true + }, "disallowSpacesInAnonymousFunctionExpression": null, "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, diff --git a/.jshintrc b/.jshintrc index f391159..620d8d7 100644 --- a/.jshintrc +++ b/.jshintrc @@ -5,7 +5,7 @@ "freeze": true, "funcscope": true, "futurehostile": true, - "globalstrict": true, + "strict": "global", "latedef": true, "maxparams": 1, "noarg": true, @@ -15,5 +15,6 @@ "singleGroups": true, "undef": true, "unused": true, - "eqnull": true + "eqnull": true, + "predef": ["exports"] } diff --git a/.travis.yml b/.travis.yml index 791313a..36183ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js -sudo: false -node_js: - - 0.10 +sudo: required +dist: trusty +node_js: 5 env: - PATH=$HOME/purescript:$PATH install: @@ -9,6 +9,16 @@ install: - 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 -g bower - npm install + - bower install script: - npm run build +after_success: +- >- + test $TRAVIS_TAG && + psc-publish > .pursuit.json && + curl -X POST http://pursuit.purescript.org/packages \ + -d @.pursuit.json \ + -H 'Accept: application/json' \ + -H "Authorization: token ${GITHUB_TOKEN}" diff --git a/README.md b/README.md index 2f37b90..53cd459 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Build Status](https://travis-ci.org/purescript/purescript-functions.svg?branch=master)](https://travis-ci.org/purescript/purescript-functions) [![Dependency Status](https://www.versioneye.com/user/projects/55848cea363861001500040b/badge.svg?style=flat)](https://www.versioneye.com/user/projects/55848cea363861001500040b) -Function combinators and types for multi-argument functions. For use with compiler version >= 0.7. +Function combinators and types for uncurried multi-argument functions. ## Installation @@ -12,6 +12,6 @@ Function combinators and types for multi-argument functions. For use with compil bower install purescript-functions ``` -## Module documentation +## Documentation -- [Data.Function](docs/Data/Function.md) +Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-functions). diff --git a/bower.json b/bower.json index 5c388a1..2107b27 100644 --- a/bower.json +++ b/bower.json @@ -1,10 +1,7 @@ { "name": "purescript-functions", "homepage": "https://github.com/purescript/purescript-functions", - "description": "Function combinators and types for multi-argument functions", - "keywords": [ - "purescript" - ], + "description": "Function combinators and types for uncurried multi-argument functions", "license": "MIT", "repository": { "type": "git", @@ -20,6 +17,6 @@ "package.json" ], "dependencies": { - "purescript-prelude": "^0.1.0" + "purescript-prelude": "^1.0.0-rc.1" } } diff --git a/docs/Data/Function.md b/docs/Data/Function.md deleted file mode 100644 index 0a051ae..0000000 --- a/docs/Data/Function.md +++ /dev/null @@ -1,282 +0,0 @@ -## Module Data.Function - -#### `on` - -``` purescript -on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c -``` - -The `on` function is used to change the domain of a binary operator. - -For example, we can create a function which compares two records based on the values of their `x` properties: - -```purescript -compareX :: forall r. { x :: Number | r } -> { x :: Number | r } -> Ordering -compareX = compare `on` _.x -``` - -#### `Fn0` - -``` purescript -data Fn0 :: * -> * -``` - -A function of zero arguments - -#### `Fn1` - -``` purescript -data Fn1 :: * -> * -> * -``` - -A function of one argument - -#### `Fn2` - -``` purescript -data Fn2 :: * -> * -> * -> * -``` - -A function of two arguments - -#### `Fn3` - -``` purescript -data Fn3 :: * -> * -> * -> * -> * -``` - -A function of three arguments - -#### `Fn4` - -``` purescript -data Fn4 :: * -> * -> * -> * -> * -> * -``` - -A function of four arguments - -#### `Fn5` - -``` purescript -data Fn5 :: * -> * -> * -> * -> * -> * -> * -``` - -A function of five arguments - -#### `Fn6` - -``` purescript -data Fn6 :: * -> * -> * -> * -> * -> * -> * -> * -``` - -A function of six arguments - -#### `Fn7` - -``` purescript -data Fn7 :: * -> * -> * -> * -> * -> * -> * -> * -> * -``` - -A function of seven arguments - -#### `Fn8` - -``` purescript -data Fn8 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -``` - -A function of eight arguments - -#### `Fn9` - -``` purescript -data Fn9 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * -``` - -A function of nine arguments - -#### `Fn10` - -``` purescript -data Fn10 :: * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * -> * -``` - -A function of ten arguments - -#### `mkFn0` - -``` purescript -mkFn0 :: forall a. (Unit -> a) -> Fn0 a -``` - -Create a function of no arguments - -#### `mkFn1` - -``` purescript -mkFn1 :: forall a b. (a -> b) -> Fn1 a b -``` - -Create a function of one argument - -#### `mkFn2` - -``` purescript -mkFn2 :: forall a b c. (a -> b -> c) -> Fn2 a b c -``` - -Create a function of two arguments from a curried function - -#### `mkFn3` - -``` purescript -mkFn3 :: forall a b c d. (a -> b -> c -> d) -> Fn3 a b c d -``` - -Create a function of three arguments from a curried function - -#### `mkFn4` - -``` purescript -mkFn4 :: forall a b c d e. (a -> b -> c -> d -> e) -> Fn4 a b c d e -``` - -Create a function of four arguments from a curried function - -#### `mkFn5` - -``` purescript -mkFn5 :: forall a b c d e f. (a -> b -> c -> d -> e -> f) -> Fn5 a b c d e f -``` - -Create a function of five arguments from a curried function - -#### `mkFn6` - -``` purescript -mkFn6 :: forall a b c d e f g. (a -> b -> c -> d -> e -> f -> g) -> Fn6 a b c d e f g -``` - -Create a function of six arguments from a curried function - -#### `mkFn7` - -``` purescript -mkFn7 :: forall a b c d e f g h. (a -> b -> c -> d -> e -> f -> g -> h) -> Fn7 a b c d e f g h -``` - -Create a function of seven arguments from a curried function - -#### `mkFn8` - -``` purescript -mkFn8 :: forall a b c d e f g h i. (a -> b -> c -> d -> e -> f -> g -> h -> i) -> Fn8 a b c d e f g h i -``` - -Create a function of eight arguments from a curried function - -#### `mkFn9` - -``` purescript -mkFn9 :: forall a b c d e f g h i j. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j) -> Fn9 a b c d e f g h i j -``` - -Create a function of nine arguments from a curried function - -#### `mkFn10` - -``` purescript -mkFn10 :: forall a b c d e f g h i j k. (a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k) -> Fn10 a b c d e f g h i j k -``` - -Create a function of ten arguments from a curried function - -#### `runFn0` - -``` purescript -runFn0 :: forall a. Fn0 a -> a -``` - -Apply a function of no arguments - -#### `runFn1` - -``` purescript -runFn1 :: forall a b. Fn1 a b -> a -> b -``` - -Apply a function of one argument - -#### `runFn2` - -``` purescript -runFn2 :: forall a b c. Fn2 a b c -> a -> b -> c -``` - -Apply a function of two arguments - -#### `runFn3` - -``` purescript -runFn3 :: forall a b c d. Fn3 a b c d -> a -> b -> c -> d -``` - -Apply a function of three arguments - -#### `runFn4` - -``` purescript -runFn4 :: forall a b c d e. Fn4 a b c d e -> a -> b -> c -> d -> e -``` - -Apply a function of four arguments - -#### `runFn5` - -``` purescript -runFn5 :: forall a b c d e f. Fn5 a b c d e f -> a -> b -> c -> d -> e -> f -``` - -Apply a function of five arguments - -#### `runFn6` - -``` purescript -runFn6 :: forall a b c d e f g. Fn6 a b c d e f g -> a -> b -> c -> d -> e -> f -> g -``` - -Apply a function of six arguments - -#### `runFn7` - -``` purescript -runFn7 :: forall a b c d e f g h. Fn7 a b c d e f g h -> a -> b -> c -> d -> e -> f -> g -> h -``` - -Apply a function of seven arguments - -#### `runFn8` - -``` purescript -runFn8 :: forall a b c d e f g h i. Fn8 a b c d e f g h i -> a -> b -> c -> d -> e -> f -> g -> h -> i -``` - -Apply a function of eight arguments - -#### `runFn9` - -``` purescript -runFn9 :: forall a b c d e f g h i j. Fn9 a b c d e f g h i j -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -``` - -Apply a function of nine arguments - -#### `runFn10` - -``` purescript -runFn10 :: forall a b c d e f g h i j k. Fn10 a b c d e f g h i j k -> a -> b -> c -> d -> e -> f -> g -> h -> i -> j -> k -``` - -Apply a function of ten arguments - - diff --git a/package.json b/package.json index e129c49..af45679 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "private": true, "scripts": { - "postinstall": "pulp dep install", - "build": "jshint src && jscs src && pulp build && rimraf docs && pulp docs" + "clean": "rimraf output && rimraf .pulp-cache", + "build": "jshint src && jscs src && pulp build" }, "devDependencies": { - "jscs": "^1.13.1", - "jshint": "^2.8.0", - "pulp": "^4.0.2", - "rimraf": "^2.4.1" + "jscs": "^2.8.0", + "jshint": "^2.9.1", + "pulp": "^8.1.0", + "rimraf": "^2.5.0" } } diff --git a/src/Data/Function.js b/src/Data/Function/Uncurried.js similarity index 99% rename from src/Data/Function.js rename to src/Data/Function/Uncurried.js index 0d6d0f4..a4e62b5 100644 --- a/src/Data/Function.js +++ b/src/Data/Function/Uncurried.js @@ -1,7 +1,6 @@ -/* global exports */ "use strict"; -// module Data.Function +// module Data.Function.Uncurried exports.mkFn0 = function (fn) { return function () { diff --git a/src/Data/Function.purs b/src/Data/Function/Uncurried.purs similarity index 89% rename from src/Data/Function.purs rename to src/Data/Function/Uncurried.purs index 37ceca1..edfb1f8 100644 --- a/src/Data/Function.purs +++ b/src/Data/Function/Uncurried.purs @@ -1,17 +1,6 @@ -module Data.Function where - -import Prelude - --- | The `on` function is used to change the domain of a binary operator. --- | --- | For example, we can create a function which compares two records based on the values of their `x` properties: --- | --- | ```purescript --- | compareX :: forall r. { x :: Number | r } -> { x :: Number | r } -> Ordering --- | compareX = compare `on` _.x --- | ``` -on :: forall a b c. (b -> b -> c) -> (a -> b) -> a -> a -> c -on f g x y = g x `f` g y +module Data.Function.Uncurried where + +import Data.Unit (Unit) -- | A function of zero arguments foreign import data Fn0 :: * -> *