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 1558c39..8b4d582 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,6 @@ Value proxy for type inputs. bower install purescript-proxy ``` -## Module documentation +## Documentation -- [Type.Proxy](docs/Type/Proxy.md) +Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-proxy). diff --git a/bower.json b/bower.json index c4558f5..254c21b 100644 --- a/bower.json +++ b/bower.json @@ -2,10 +2,11 @@ "name": "purescript-proxy", "homepage": "https://github.com/purescript/purescript-proxy", "description": "Value proxy for type inputs", - "keywords": [ - "purescript" - ], "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/purescript/purescript-proxy.git" + }, "ignore": [ "**/.*", "bower_components", diff --git a/docs/Type/Proxy.md b/docs/Type/Proxy.md deleted file mode 100644 index 2e928ea..0000000 --- a/docs/Type/Proxy.md +++ /dev/null @@ -1,79 +0,0 @@ -## Module Type.Proxy - -The `Proxy` type and values are for situations where type information is -required for an input to determine the type of an output, but where it is -not possible or convenient to provide a _value_ for the input. - -A hypothetical example: if you have a class that is used to handle the -result of an AJAX request, you may want to use this information to set the -expected content type of the request, so you might have a class something -like this: - -``` purescript -class AjaxResponse a where - responseType :: a -> ResponseType - fromResponse :: Foreign -> a -``` - -The problem here is `responseType` requires a value of type `a`, but we -won't have a value of that type until the request has been completed. The -solution is to use a `Proxy` type instead: - -``` purescript -class AjaxResponse a where - responseType :: Proxy a -> ResponseType - fromResponse :: Foreign -> a -``` - -We can now call `responseType (Proxy :: Proxy SomeContentType)` to produce -a `ResponseType` for `SomeContentType` without having to construct some -empty version of `SomeContentType` first. In situations like this where -the `Proxy` type can be statically determined, it is recommended to pull -out the definition to the top level and make a declaration like: - -``` purescript -_SomeContentType :: Proxy SomeContentType -_SomeContentType = Proxy -``` - -That way the proxy value can be used as `responseType _SomeContentType` -for improved readability. However, this is not always possible, sometimes -the type required will be determined by a type variable. As PureScript has -scoped type variables, we can do things like this: - -``` purescript -makeRequest :: URL -> ResponseType -> Aff _ Foreign -makeRequest = ... - -fetchData :: forall a. (AjaxResponse a) => URL -> Aff _ a -fetchData url = fromResponse <$> makeRequest url (responseType (Proxy :: Proxy a)) -``` - -#### `Proxy` - -``` purescript -data Proxy a - = Proxy -``` - -Value proxy for kind `*` types. - -#### `Proxy2` - -``` purescript -data Proxy2 (a :: * -> *) - = Proxy2 -``` - -Value proxy for kind `* -> *` types. - -#### `Proxy3` - -``` purescript -data Proxy3 (a :: * -> * -> *) - = Proxy3 -``` - -Value proxy for kind `* -> * -> *` types. - - diff --git a/package.json b/package.json index 509a91f..f7e0e40 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "private": true, "scripts": { - "postinstall": "pulp dep install", - "build": "pulp build && rimraf docs && pulp docs" + "clean": "rimraf output && rimraf .pulp-cache", + "build": "pulp build" }, "devDependencies": { - "pulp": "^4.0.2", - "rimraf": "^2.4.1" + "pulp": "^8.1.0", + "rimraf": "^2.5.0" } }