Skip to content

Commit

Permalink
Merge pull request #4 from purescript/0.8-updates
Browse files Browse the repository at this point in the history
Updates for PureScript 0.8
  • Loading branch information
garyb committed Mar 13, 2016
2 parents 2f79fcb + b653576 commit 767f08b
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 67 deletions.
13 changes: 8 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
bower_components
output
node_modules
.psci
.psci_modules/
/.*
!/.gitignore
!/.jscsrc
!/.jshintrc
!/.travis.yml
/bower_components/
/node_modules/
/output/
17 changes: 17 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"preset": "grunt",
"disallowSpacesInFunctionExpression": null,
"requireSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": null,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInsideObjectBrackets": null,
"requireSpacesInsideObjectBrackets": "all",
"validateQuoteMarks": "\"",
"requireCurlyBraces": null
}
5 changes: 3 additions & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"freeze": true,
"funcscope": true,
"futurehostile": true,
"globalstrict": true,
"strict": "global",
"latedef": true,
"maxparams": 1,
"noarg": true,
Expand All @@ -15,5 +15,6 @@
"singleGroups": true,
"undef": true,
"unused": true,
"eqnull": true
"eqnull": true,
"predef": ["exports"]
}
18 changes: 14 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
language: node_js
sudo: false
node_js:
- 0.10
sudo: required
dist: trusty
node_js: 5
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 -g bower
- npm install
- bower install
script:
- npm run build
- npm test
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}"
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) 2015 PureScript

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# purescript-unsafe-coerce

[![Build Status](https://travis-ci.org/purescript-contrib/purescript-unsafe-coerce.svg?branch=master)](https://travis-ci.org/purescript-contrib/purescript-unsafe-coerce)
[![Maintainer: hdgarrood](https://img.shields.io/badge/maintainer-hdgarrood-lightgrey.svg)](http://github.com/hdgarrood)
[![Build Status](https://travis-ci.org/purescript/purescript-unsafe-coerce.svg?branch=master)](https://travis-ci.org/purescript/purescript-unsafe-coerce)
[![Build Status](https://travis-ci.org/purescript/purescript-unsafe-coerce.svg?branch=master)](https://travis-ci.org/purescript/purescript-unsafe-coerce)
[![Dependency Status](https://www.versioneye.com/user/projects/56ae47da7e03c7003ba4166b/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56ae47da7e03c7003ba4166b)

Unsafe coercion of values.
A _highly unsafe_ function, which can be used to persuade the type system that any type is the same as any other type. When using this function, it is your (that is, the caller's) responsibility to ensure that the underlying representation for both types is the same.

- [Module Documentation](docs/Unsafe/Coerce.md)
There are few situations where it is acceptable to use this function, it should only ever appear as an internal implementation detail of a library, never as a function used in a "normal" codebase.

## Installation

```
bower install purescript-unsafe-coerce
```

## Documentation

Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-unsafe-coerce).
17 changes: 9 additions & 8 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"name": "purescript-unsafe-coerce",
"homepage": "https://github.com/purescript/purescript-unsafe-coerce",
"description": "Unsafe coercion of values.",
"version": "0.1.0",
"moduleType": [
"node"
],
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/purescript-contrib/purescript-unsafe-coerce"
"url": "git://github.com/purescript/purescript-unsafe-coerce"
},
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"output"
"node_modules",
"output",
"test",
"bower.json",
"package.json"
],
"devDependencies": {
"purescript-console": "^0.1.0"
"purescript-console": "^1.0.0-rc.1"
}
}
31 changes: 0 additions & 31 deletions docs/Unsafe/Coerce.md

This file was deleted.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
{
"private": true,
"scripts": {
"postinstall": "pulp dep install",
"build": "pulp build && pulp test && rimraf docs && pulp docs"
"clean": "rimraf output && rimraf .pulp-cache",
"build": "jshint src && jscs src && pulp build",
"test": "jshint src && jscs src && pulp test"
},
"devDependencies": {
"pulp": "^4.0.1",
"rimraf": "^2.4.1"
"jscs": "^2.8.0",
"jshint": "^2.9.1",
"pulp": "^8.1.0",
"rimraf": "^2.5.0"
}
}
5 changes: 2 additions & 3 deletions src/Unsafe/Coerce.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* global exports */
"use strict";

// module Unsafe.Coerce

exports.unsafeCoerce = function(x) {
return x;
exports.unsafeCoerce = function (x) {
return x;
};
18 changes: 12 additions & 6 deletions test/Main.purs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
module Test.Main where

import Prelude
import Unsafe.Coerce (unsafeCoerce)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)

import Data.Functor (class Functor)
import Data.Semigroup ((<>))
import Data.Unit (Unit)

import Control.Monad.Eff.Console
import Unsafe.Coerce (unsafeCoerce)

newtype Foo = Foo String

Expand All @@ -16,8 +20,10 @@ coerceFoo = unsafeCoerce

-- | It is also safe to coerce entire collections, without having to map over
-- | individual elements.
coerceFoos :: forall f. (Functor f) => f Foo -> f Bar
coerceFoos :: forall f. Functor f => f Foo -> f Bar
coerceFoos = unsafeCoerce

main = case coerceFoos [Foo "Hello", Foo " ", Foo "World"] of
[Bar x, Bar y, Bar z] -> log (x <> y <> z)
main :: Eff (console :: CONSOLE) Unit
main =
case coerceFoos [Foo "Hello", Foo " ", Foo "World"] of
[Bar x, Bar y, Bar z] -> log (x <> y <> z)

0 comments on commit 767f08b

Please sign in to comment.