Skip to content

Commit 961159f

Browse files
authored
Merge pull request #24 from garyb/0.10-updates
Updates for PureScript 0.10
2 parents eed0196 + b7aa74d commit 961159f

File tree

9 files changed

+63
-65
lines changed

9 files changed

+63
-65
lines changed

.eslintrc.json

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

.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 & 19 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# purescript-ace
22

3-
PureScript bindings for the [Ace code editor](http://ace.c9.io).
3+
[![Latest release](http://img.shields.io/github/release/slamdata/purescript-ace.svg)](https://github.com/slamdata/purescript-ace/releases)
4+
[![Build status](https://travis-ci.org/slamdata/purescript-ace.svg?branch=master)](https://travis-ci.org/slamdata/purescript-ace)
5+
[![Dependency status](https://img.shields.io/librariesio/github/slamdata/purescript-ace.svg)](https://libraries.io/github/slamdata/purescript-ace)
46

5-
[![Latest release](http://img.shields.io/bower/v/purescript-ace.svg)](https://github.com/slamdata/purescript-ace/releases)
6-
[![Build Status](https://travis-ci.org/slamdata/purescript-ace.svg?branch=master)](https://travis-ci.org/slamdata/purescript-ace)
7-
[![Dependency Status](https://www.versioneye.com/user/projects/5769eab0fdabcd003d086c62/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5769eab0fdabcd003d086c62)
7+
PureScript bindings for the [Ace code editor](http://ace.c9.io).
88

99
## API
1010

bower.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
"package.json"
2020
],
2121
"dependencies": {
22-
"purescript-console": "^1.0.0",
23-
"purescript-dom": "^2.0.0",
24-
"purescript-arrays": "^1.1.0",
25-
"purescript-foreign": "^1.0.0",
26-
"purescript-nullable": "^1.0.1",
27-
"purescript-prelude": "^1.0.1"
22+
"purescript-console": "^2.0.0",
23+
"purescript-dom": "^3.1.0",
24+
"purescript-arrays": "^3.0.0",
25+
"purescript-foreign": "^3.0.0",
26+
"purescript-nullable": "^2.0.0",
27+
"purescript-prelude": "^2.1.0"
2828
},
2929
"devDependencies": {
30-
"ace-builds": "^1.2.4",
31-
"purescript-refs": "^1.0.0"
30+
"ace-builds": "^1.2.5",
31+
"purescript-refs": "^2.0.0"
3232
}
3333
}

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src && jscs src && pulp build --censor-lib --strict",
6-
"test": "pulp build -I example/src --to example/example.js"
5+
"build": "eslint src && pulp build --censor-lib --strict",
6+
"test": "pulp build -I example/src"
77
},
88
"devDependencies": {
9-
"jscs": "^3.0.7",
10-
"jshint": "^2.9.2",
9+
"eslint": "^3.8.1",
1110
"pulp": "^9.0.1",
11+
"purescript": "^0.10.1",
1212
"purescript-psa": "^0.3.9",
13-
"purescript": "^0.9.2",
1413
"rimraf": "^2.5.4"
1514
}
1615
}

src/Ace/Document.purs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,18 @@ module Ace.Document
2727
) where
2828

2929
import Prelude
30+
3031
import Ace.Types (Document, ACE, Position, Range, NewlineMode, Anchor, DocumentEvent, showNewlineMode)
32+
3133
import Control.Monad.Eff (Eff)
34+
import Control.Monad.Except (runExcept)
35+
3236
import Data.Either (fromRight)
3337
import Data.Foreign (Foreign)
3438
import Data.Foreign.Class (read)
3539
import Data.Function.Uncurried (Fn2, runFn2, Fn3, runFn3, Fn4, runFn4)
3640
import Data.Nullable (Nullable)
41+
3742
import Partial.Unsafe (unsafePartial)
3843

3944
foreign import onChangeImpl
@@ -44,7 +49,7 @@ onChange
4449
:: forall eff a
4550
. Document -> (DocumentEvent -> Eff (ace :: ACE | eff) a)
4651
-> Eff (ace :: ACE | eff) Unit
47-
onChange self fn = runFn2 onChangeImpl self (fn <<< (unsafePartial fromRight) <<< read)
52+
onChange self fn = runFn2 onChangeImpl self (fn <<< (unsafePartial fromRight) <<< runExcept <<< read)
4853

4954
foreign import setValueImpl
5055
:: forall eff. Fn2 String Document (Eff (ace :: ACE | eff) Unit)

src/Ace/Types.purs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ module Ace.Types where
22

33
import Prelude
44

5-
import Data.Either (Either(..))
6-
import Data.Foreign (F, ForeignError(..), readString)
5+
import Data.Foreign (F, ForeignError(..), readString, fail)
76
import Data.Foreign.Class (class IsForeign, readProp)
87
import Data.Maybe (Maybe)
98

@@ -21,10 +20,10 @@ showDocumentEventType Insert = "insert"
2120
showDocumentEventType Remove = "remove"
2221

2322
readDocumentEventType :: String -> F DocumentEventType
24-
readDocumentEventType "insert" = Right Insert
25-
readDocumentEventType "remove" = Right Remove
23+
readDocumentEventType "insert" = pure Insert
24+
readDocumentEventType "remove" = pure Remove
2625
readDocumentEventType s =
27-
Left $ TypeMismatch ("'" <> s <> "'") " a valid value for the DocumentEventType enum"
26+
fail $ TypeMismatch ("'" <> s <> "'") " a valid value for the DocumentEventType enum"
2827

2928

3029
instance documentEventTypeIsForeign :: IsForeign DocumentEventType where
@@ -56,11 +55,11 @@ showNewlineMode Unix = "unix"
5655
showNewlineMode Auto = "auto"
5756

5857
readNewlineMode :: String -> F NewlineMode
59-
readNewlineMode "windows" = Right Windows
60-
readNewlineMode "unix" = Right Unix
61-
readNewlineMode "auto" = Right Auto
58+
readNewlineMode "windows" = pure Windows
59+
readNewlineMode "unix" = pure Unix
60+
readNewlineMode "auto" = pure Auto
6261
readNewlineMode s =
63-
Left $ TypeMismatch ("'" <> s <> "'") " a valid value for the NewlineMode enum"
62+
fail $ TypeMismatch ("'" <> s <> "'") " a valid value for the NewlineMode enum"
6463

6564
data Rules
6665

0 commit comments

Comments
 (0)