Skip to content

Commit f70e919

Browse files
committed
Merge pull request #10 from purescript-contrib/0.9-updates
Updates for PureScript 0.9.1
2 parents 1f78e83 + 10958ae commit f70e919

File tree

7 files changed

+50
-51
lines changed

7 files changed

+50
-51
lines changed

.travis.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
language: node_js
2-
sudo: false
3-
node_js:
4-
- 4
2+
dist: trusty
3+
sudo: required
4+
node_js: 6
55
install:
6+
- npm install -g bower
67
- npm install
78
script:
8-
- npm test
9+
- bower install --production
10+
- npm run -s build
11+
- bower install
12+
- npm -s test
913
after_success:
1014
- >-
1115
test $TRAVIS_TAG &&
12-
npm install bower -g &&
13-
node_modules/.bin/psc-publish > .pursuit.json &&
14-
curl -X POST http://pursuit.purescript.org/packages \
15-
-d @.pursuit.json \
16-
-H 'Accept: application/json' \
17-
-H "Authorization: token ${GITHUB_TOKEN}"
16+
echo $GITHUB_TOKEN | pulp login &&
17+
echo y | pulp publish --no-push

bower.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"Hardy Jones <>",
77
"John A. De Goes <[email protected]>"
88
],
9-
"description": "Core of purescript-argonaut library, it provides basic types, folds and combinators for `Json`",
9+
"description": "Core of the purescript-argonaut library, providing basic types, folds, and combinators for `Json`",
1010
"keywords": [
1111
"purescript",
1212
"argonaut",
@@ -18,11 +18,11 @@
1818
},
1919
"license": "MIT",
2020
"dependencies": {
21-
"purescript-enums": "^0.7.0",
22-
"purescript-functions": "^0.1.0",
23-
"purescript-maps": "^0.5.0"
21+
"purescript-enums": "^1.0.0",
22+
"purescript-functions": "^1.0.0",
23+
"purescript-maps": "^1.0.0"
2424
},
2525
"devDependencies": {
26-
"purescript-strongcheck": "^0.14.0"
26+
"purescript-strongcheck": "^1.0.0"
2727
}
2828
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"private": true,
33
"scripts": {
4-
"postinstall": "pulp dep install",
54
"clean": "rimraf output && rimraf .pulp-cache",
6-
"build": "pulp build",
5+
"build": "pulp build --censor-lib --strict",
76
"test": "pulp test"
87
},
98
"devDependencies": {
10-
"pulp": "^5.0.2",
11-
"purescript": "^0.7.6",
12-
"rimraf": "^2.4.4"
9+
"pulp": "^9.0.0",
10+
"purescript-psa": "^0.3.9",
11+
"purescript": "^0.9.1",
12+
"rimraf": "^2.5.0"
1313
}
1414
}

src/Data/Argonaut/Core.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ module Data.Argonaut.Core
4747

4848
import Prelude
4949

50-
import Data.Tuple (Tuple())
50+
import Data.Tuple (Tuple)
5151
import Data.Maybe (Maybe(..))
52-
import Data.Function
52+
import Data.Function.Uncurried (Fn5, runFn5, Fn7, runFn7)
5353

54-
import qualified Data.StrMap as M
54+
import Data.StrMap as M
5555

5656
-- | A Boolean value inside some JSON data. Note that this type is exactly the
5757
-- | same as the primitive `Boolean` type; this synonym acts only to help

src/Data/Argonaut/Parser.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module Data.Argonaut.Parser (jsonParser) where
22

3-
import Data.Argonaut.Core (Json())
4-
import Data.Function (Fn3(), runFn3)
3+
import Data.Argonaut.Core (Json)
54
import Data.Either (Either(..))
5+
import Data.Function.Uncurried (Fn3, runFn3)
66

77
foreign import _jsonParser :: forall a. Fn3 (String -> a) (Json -> a) String a
88

src/Data/Argonaut/Printer.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
module Data.Argonaut.Printer (Printer, printJson) where
1+
module Data.Argonaut.Printer where
22

33
import Prelude
4-
import Data.Argonaut.Core (Json())
4+
5+
import Data.Argonaut.Core (Json)
56

67
class Printer a where
78
printJson :: Json -> a
89

910
instance printerString :: Printer String where
1011
printJson = show
11-

test/Test/Main.purs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ module Test.Main where
22

33
import Prelude
44

5-
import Control.Monad.Eff (Eff())
65
import Control.Monad.Eff.Console (log)
7-
import Data.Maybe (Maybe(..))
8-
import Data.Maybe.Unsafe (fromJust)
6+
7+
import Data.Argonaut.Core (Json, JNull, toObject, toArray, toString, toNumber, toBoolean, toNull, fromObject, foldJsonObject, fromNumber, fromArray, foldJsonArray, fromString, foldJsonString, foldJsonNumber, fromBoolean, foldJsonBoolean, fromNull, foldJsonNull, foldJson, isObject, isArray, isString, isNumber, isBoolean, isNull)
8+
import Data.Argonaut.Parser (jsonParser)
9+
import Data.Argonaut.Printer (printJson)
10+
import Data.Array as A
911
import Data.Either (isLeft, isRight, Either(..))
10-
import Data.Tuple (Tuple(..))
1112
import Data.Foldable (for_)
12-
import qualified Data.Array as A
13-
import qualified Data.StrMap as M
13+
import Data.Maybe (Maybe(..), fromJust)
14+
import Data.StrMap as M
15+
import Data.Tuple (Tuple(..))
1416

15-
import Data.Argonaut.Core
16-
import Data.Argonaut.Parser
17-
import Data.Argonaut.Printer
17+
import Partial.Unsafe (unsafePartial)
1818

19-
import Test.StrongCheck (assert, (<?>), quickCheck, Result())
19+
import Test.StrongCheck (SC, assert, (<?>), quickCheck, Result())
2020

2121
foreign import thisIsNull :: Json
2222
foreign import thisIsBoolean :: Json
@@ -26,7 +26,7 @@ foreign import thisIsArray :: Json
2626
foreign import thisIsObject :: Json
2727
foreign import nil :: JNull
2828

29-
isTest :: Eff _ Unit
29+
isTest :: SC () Unit
3030
isTest = do
3131
assert (isNull thisIsNull <?> "Error in null test")
3232
assert (isBoolean thisIsBoolean <?> "Error in boolean test")
@@ -35,7 +35,7 @@ isTest = do
3535
assert (isArray thisIsArray <?> "Error in array test")
3636
assert (isObject thisIsObject <?> "Error in object test")
3737

38-
foldTest :: Eff _ Unit
38+
foldTest :: SC () Unit
3939
foldTest = do
4040
assert (foldFn thisIsNull == "null" <?> "Error in foldJson null")
4141
assert (foldFn thisIsBoolean == "boolean" <?> "Error in foldJson boolean")
@@ -44,7 +44,6 @@ foldTest = do
4444
assert (foldFn thisIsArray == "array" <?> "Error in foldJson array")
4545
assert (foldFn thisIsObject == "object" <?> "Error in foldJson object")
4646

47-
4847
foldFn :: Json -> String
4948
foldFn = foldJson
5049
(const "null")
@@ -55,7 +54,7 @@ foldFn = foldJson
5554
(const "object")
5655

5756
cases :: Array Json
58-
cases =
57+
cases =
5958
[ thisIsNull
6059
, thisIsBoolean
6160
, thisIsNumber
@@ -64,7 +63,7 @@ cases =
6463
, thisIsObject
6564
]
6665

67-
foldXXX :: Eff _ Unit
66+
foldXXX :: SC () Unit
6867
foldXXX = do
6968
assert ((foldJsonNull "not null" (const "null") <$> cases) ==
7069
["null", "not null", "not null", "not null", "not null", "not null"] <?>
@@ -88,7 +87,7 @@ foldXXX = do
8887
"Error in foldJsonObject")
8988

9089

91-
fromTest :: Eff _ Unit
90+
fromTest :: SC () Unit
9291
fromTest = do
9392
assert ((foldJsonNull false (const true) (fromNull nil)) <?> "Error in fromNull")
9493
quickCheck (\bool -> foldJsonBoolean Nothing Just (fromBoolean bool) == Just bool <?> "Error in fromBoolean")
@@ -105,7 +104,7 @@ fromTest = do
105104
in (foldJsonObject Nothing Just (fromObject sm) == Just sm)
106105
<?> "Error in fromObject")
107106

108-
toTest :: Eff _ Unit
107+
toTest :: SC () Unit
109108
toTest = do
110109
assert (assertion toNull thisIsNull "Error in toNull")
111110
assert (assertion toBoolean thisIsBoolean "Error in toBoolean")
@@ -117,25 +116,25 @@ toTest = do
117116
assertion :: forall a. (Eq a) => (Json -> Maybe a) -> Json -> String -> Result
118117
assertion fn j msg =
119118
let forCases = A.catMaybes (fn <$> cases)
120-
exact = A.singleton $ fromJust $ fn j
119+
exact = A.singleton $ unsafePartial fromJust $ fn j
121120
in forCases == exact <?> msg
122121

123122

124-
parserTest :: Eff _ Unit
123+
parserTest :: SC () Unit
125124
parserTest = do
126125
assert ((isRight (jsonParser "{\"foo\": 1}")) <?> "Error in jsonParser")
127126
assert ((isLeft (jsonParser "\\\ffff")) <?> "Error in jsonParser")
128127

129-
printJsonTest :: Eff _ Unit
128+
printJsonTest :: SC () Unit
130129
printJsonTest = do
131130
for_ cases (assert <<< assertion)
132131
where
133132
assertion :: Json -> Result
134133
assertion j = ((jsonParser (printJson j)) == Right j) <?> "Error in printJson"
135134

136-
main :: Eff _ Unit
135+
main :: SC () Unit
137136
main = do
138-
log "isXxx tests"
137+
log "isXxx tests"
139138
isTest
140139
log "foldJson tests"
141140
foldTest
@@ -147,5 +146,5 @@ main = do
147146
toTest
148147
log "jsonParser tests"
149148
parserTest
150-
log "printJson tests"
149+
log "printJson tests"
151150
printJsonTest

0 commit comments

Comments
 (0)