Skip to content

Commit cf21328

Browse files
authored
Merge pull request #120 from purescript/ps-0.11
Update for PureScript 0.11
2 parents b9c91d0 + 4eb5a27 commit cf21328

13 files changed

+45
-63
lines changed

.eslintrc.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5
4+
},
5+
"extends": "eslint:recommended",
6+
"env": {
7+
"commonjs": true
8+
},
9+
"rules": {
10+
"strict": [2, "global"],
11+
"block-scoped-var": 2,
12+
"consistent-return": 2,
13+
"eqeqeq": [2, "smart"],
14+
"guard-for-in": 2,
15+
"no-caller": 2,
16+
"no-extend-native": 2,
17+
"no-loop-func": 2,
18+
"no-new": 2,
19+
"no-param-reassign": 2,
20+
"no-return-assign": 2,
21+
"no-unused-expressions": 2,
22+
"no-use-before-define": 2,
23+
"radix": [2, "always"],
24+
"indent": [2, 2, { "SwitchCase": 1 }],
25+
"quotes": [2, "double"],
26+
"semi": [2, "always"]
27+
}
28+
}

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/.*
22
!/.gitignore
3-
!/.jscsrc
4-
!/.jshintrc
3+
!/.eslintrc.json
54
!/.travis.yml
65
/bower_components/
76
/node_modules/

.jscsrc

-17
This file was deleted.

.jshintrc

-20
This file was deleted.

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22
dist: trusty
33
sudo: required
4-
node_js: 6
4+
node_js: stable
55
env:
66
- PATH=$HOME/purescript:$PATH
77
install:

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src && jscs src && psa \"src/**/*.purs\" \"bower_components/purescript-*/**/*.purs\" --censor-lib --strict",
6-
"test": "psc \"src/**/*.purs\" \"bower_components/purescript-*/**/*.purs\" \"test/**/*.purs\" && psc-bundle \"output/**/*.js\" --module Test.Main --main Test.Main | node"
5+
"build": "eslint src && pulp build -- --censor-lib --strict",
6+
"test": "pulp test"
77
},
88
"devDependencies": {
9-
"jscs": "^2.8.0",
10-
"jshint": "^2.9.1",
11-
"purescript-psa": "^0.3.8",
12-
"rimraf": "^2.5.0"
9+
"eslint": "^3.17.1",
10+
"purescript-psa": "^0.5.0-rc.1",
11+
"pulp": "^10.0.4",
12+
"rimraf": "^2.6.1"
1313
}
1414
}

src/Data/Eq.purs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ class Eq1 f where
6565
instance eq1Array :: Eq1 Array where
6666
eq1 = eq
6767

68-
notEq1 :: forall f a. (Eq1 f, Eq a) => f a -> f a -> Boolean
68+
notEq1 :: forall f a. Eq1 f => Eq a => f a -> f a -> Boolean
6969
notEq1 x y = (x `eq1` y) == false

src/Data/EuclideanRing.purs

+2-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import Data.CommutativeRing (class CommutativeRing)
1212
import Data.Eq (class Eq, (==))
1313
import Data.Ring (class Ring, sub, (-))
1414
import Data.Semiring (class Semiring, add, mul, one, zero, (*), (+))
15-
import Data.Unit (Unit, unit)
1615

1716
-- | The `EuclideanRing` class is for commutative rings that support division.
1817
-- | The mathematical structure this class is based on is sometimes also called
@@ -63,26 +62,21 @@ instance euclideanRingNumber :: EuclideanRing Number where
6362
div = numDiv
6463
mod _ _ = 0.0
6564

66-
instance euclideanRingUnit :: EuclideanRing Unit where
67-
degree _ = 1
68-
div _ _ = unit
69-
mod _ _ = unit
70-
7165
foreign import intDegree :: Int -> Int
7266
foreign import intDiv :: Int -> Int -> Int
7367
foreign import intMod :: Int -> Int -> Int
7468

7569
foreign import numDiv :: Number -> Number -> Number
7670

7771
-- | The *greatest common divisor* of two values.
78-
gcd :: forall a. (Eq a, EuclideanRing a) => a -> a -> a
72+
gcd :: forall a. Eq a => EuclideanRing a => a -> a -> a
7973
gcd a b =
8074
if b == zero
8175
then a
8276
else gcd b (a `mod` b)
8377

8478
-- | The *least common multiple* of two values.
85-
lcm :: forall a. (Eq a, EuclideanRing a) => a -> a -> a
79+
lcm :: forall a. Eq a => EuclideanRing a => a -> a -> a
8680
lcm a b =
8781
if a == zero || b == zero
8882
then zero

src/Data/Field.purs

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Data.CommutativeRing (class CommutativeRing)
1010
import Data.EuclideanRing (class EuclideanRing, degree, div, mod, (/), gcd, lcm)
1111
import Data.Ring (class Ring, negate, sub)
1212
import Data.Semiring (class Semiring, add, mul, one, zero, (*), (+))
13-
import Data.Unit (Unit)
1413

1514
-- | The `Field` class is for types that are commutative fields.
1615
-- |
@@ -25,4 +24,3 @@ import Data.Unit (Unit)
2524
class EuclideanRing a <= Field a
2625

2726
instance fieldNumber :: Field Number
28-
instance fieldUnit :: Field Unit

src/Data/Ord.purs

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ between low hi x
155155

156156
-- | The absolute value function. `abs x` is defined as `if x >= zero then x
157157
-- | else negate x`.
158-
abs :: forall a. (Ord a, Ring a) => a -> a
158+
abs :: forall a. Ord a => Ring a => a -> a
159159
abs x = if x >= zero then x else negate x
160160

161161
-- | The sign function; always evaluates to either `one` or `negate one`. For
162162
-- | any `x`, we should have `signum x * abs x == x`.
163-
signum :: forall a. (Ord a, Ring a) => a -> a
163+
signum :: forall a. Ord a => Ring a => a -> a
164164
signum x = if x >= zero then one else negate one
165165

166166
-- | The `Ord1` type class represents totally ordered type constructors.

src/Data/Show.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ exports.showCharImpl = function (c) {
2929
exports.showStringImpl = function (s) {
3030
var l = s.length;
3131
return "\"" + s.replace(
32-
/[\0-\x1F\x7F"\\]/g,
33-
function (c, i) { // jshint ignore:line
32+
/[\0-\x1F\x7F"\\]/g, // eslint-disable-line no-control-regex
33+
function (c, i) {
3434
switch (c) {
3535
case "\"":
3636
case "\\":

src/Data/Unit.purs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Data.Show (class Show)
88
-- | `Unit` is often used, wrapped in a monadic type constructor, as the
99
-- | return type of a computation where only
1010
-- | the _effects_ are important.
11-
foreign import data Unit :: *
11+
foreign import data Unit :: Type
1212

1313
-- | `unit` is the sole inhabitant of the `Unit` type.
1414
foreign import unit :: Unit

test/Test/Main.purs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ foreign import throwErr :: String -> AlmostEff
1717
assert :: String -> Boolean -> AlmostEff
1818
assert msg condition = if condition then const unit else throwErr msg
1919

20-
testOrd :: forall a. (Ord a, Show a) => a -> a -> Ordering -> AlmostEff
20+
testOrd :: forall a. Ord a => Show a => a -> a -> Ordering -> AlmostEff
2121
testOrd x y ord =
2222
assert
2323
("(compare " <> show x <> " " <> show y <> " ) is not equal to " <> show ord)

0 commit comments

Comments
 (0)