Skip to content

Commit e3abdd1

Browse files
authored
Merge pull request #98 from purescript/ps-0.11
Update for PureScript 0.11
2 parents 6958fc2 + 37515a1 commit e3abdd1

File tree

12 files changed

+71
-79
lines changed

12 files changed

+71
-79
lines changed

.eslintrc.json

Lines changed: 28 additions & 0 deletions
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],
25+
"quotes": [2, "double"],
26+
"semi": [2, "always"]
27+
}
28+
}

.gitignore

Lines changed: 1 addition & 2 deletions
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

Lines changed: 0 additions & 17 deletions
This file was deleted.

.jshintrc

Lines changed: 0 additions & 20 deletions
This file was deleted.

.travis.yml

Lines changed: 1 addition & 1 deletion
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:

bower.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
"package.json"
1717
],
1818
"dependencies": {
19-
"purescript-foldable-traversable": "^2.0.0",
20-
"purescript-nonempty": "^3.0.0",
21-
"purescript-partial": "^1.1.0",
22-
"purescript-st": "^2.0.0",
23-
"purescript-tailrec": "^2.0.0",
24-
"purescript-tuples": "^3.0.0",
25-
"purescript-unfoldable": "^2.0.0",
26-
"purescript-unsafe-coerce": "^2.0.0"
19+
"purescript-foldable-traversable": "^3.0.0",
20+
"purescript-nonempty": "^4.0.0",
21+
"purescript-partial": "^1.2.0",
22+
"purescript-st": "^3.0.0",
23+
"purescript-tailrec": "^3.0.0",
24+
"purescript-tuples": "^4.0.0",
25+
"purescript-unfoldable": "^3.0.0",
26+
"purescript-unsafe-coerce": "^3.0.0"
2727
},
2828
"devDependencies": {
29-
"purescript-assert": "^2.0.0",
30-
"purescript-console": "^2.0.0",
31-
"purescript-const": "^2.0.0"
29+
"purescript-assert": "^3.0.0",
30+
"purescript-console": "^3.0.0",
31+
"purescript-const": "^3.0.0"
3232
}
3333
}

package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src && jscs src && pulp build --censor-lib --strict",
5+
"build": "eslint src && pulp build -- --censor-lib --strict",
66
"test": "pulp test"
77
},
88
"devDependencies": {
9-
"jscs": "^2.8.0",
10-
"jshint": "^2.9.1",
11-
"pulp": "^9.0.1",
12-
"purescript-psa": "^0.3.9",
13-
"rimraf": "^2.5.0"
9+
"eslint": "^3.17.1",
10+
"pulp": "^10.0.4",
11+
"purescript-psa": "^0.5.0-rc.1",
12+
"rimraf": "^2.6.1"
1413
}
1514
}

src/Data/Array.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ exports.range = function (start) {
88
return function (end) {
99
var step = start > end ? -1 : 1;
1010
var result = [];
11-
for (var i = start, n = 0; i !== end; i += step) {
11+
var i = start, n = 0;
12+
while (i !== end) {
1213
result[n++] = i;
14+
i += step;
1315
}
1416
result[n] = i;
1517
return result;
@@ -59,9 +61,10 @@ exports.fromFoldableImpl = (function () {
5961
function listToArray(list) {
6062
var result = [];
6163
var count = 0;
62-
while (list !== emptyList) {
63-
result[count++] = list.head;
64-
list = list.tail;
64+
var xs = list;
65+
while (xs !== emptyList) {
66+
result[count++] = xs.head;
67+
xs = xs.tail;
6568
}
6669
return result;
6770
}

src/Data/Array.purs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ import Prelude
113113
import Control.Alt ((<|>))
114114
import Control.Alternative (class Alternative)
115115
import Control.Lazy (class Lazy, defer)
116-
import Control.Monad.Rec.Class (class MonadRec, Step(..), tailRecM2)
116+
import Control.Monad.Rec.Class (class MonadRec, Step(..), tailRecM2, tailRec)
117117
import Control.Monad.ST (pureST)
118118
import Data.Array.ST (unsafeFreeze, emptySTArray, pushSTArray)
119119
import Data.Array.ST.Iterator (iterator, iterate, pushWhile)
@@ -163,15 +163,15 @@ infix 8 range as ..
163163
-- |
164164
-- | The `Lazy` constraint is used to generate the result lazily, to ensure
165165
-- | termination.
166-
some :: forall f a. (Alternative f, Lazy (f (Array a))) => f a -> f (Array a)
166+
some :: forall f a. Alternative f => Lazy (f (Array a)) => f a -> f (Array a)
167167
some v = (:) <$> v <*> defer (\_ -> many v)
168168

169169
-- | Attempt a computation multiple times, returning as many successful results
170170
-- | as possible (possibly zero).
171171
-- |
172172
-- | The `Lazy` constraint is used to generate the result lazily, to ensure
173173
-- | termination.
174-
many :: forall f a. (Alternative f, Lazy (f (Array a))) => f a -> f (Array a)
174+
many :: forall f a. Alternative f => Lazy (f (Array a)) => f a -> f (Array a)
175175
many v = some v <|> pure []
176176

177177
--------------------------------------------------------------------------------
@@ -521,13 +521,13 @@ span p arr =
521521
{ init: arr, rest: [] }
522522
where
523523
breakIndex = go 0
524-
go i =
524+
go = tailRec \i ->
525525
-- This looks like a good opportunity to use the Monad Maybe instance,
526526
-- but it's important to write out an explicit case expression here in
527527
-- order to ensure that TCO is triggered.
528528
case index arr i of
529-
Just x -> if p x then go (i+1) else Just i
530-
Nothing -> Nothing
529+
Just x -> if p x then Loop (i + 1) else Done (Just i)
530+
Nothing -> Done Nothing
531531

532532
-- | Group equal, consecutive elements of an array into arrays.
533533
-- |

src/Data/Array/ST.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import Unsafe.Coerce (unsafeCoerce)
3131
-- |
3232
-- | The runtime representation of a value of type `STArray h a` is the same as that of `Array a`,
3333
-- | except that mutation is allowed.
34-
foreign import data STArray :: * -> * -> *
34+
foreign import data STArray :: Type -> Type -> Type
3535

3636
-- | An element and its index.
3737
type Assoc a = { value :: a, index :: Int }

0 commit comments

Comments
 (0)