Skip to content
This repository was archived by the owner on Dec 18, 2020. It is now read-only.

Commit 3c6251d

Browse files
authored
Merge pull request #17 from purescript/compiler/0.12
Update for PureScript 0.12
2 parents 52442c3 + 98e782c commit 3c6251d

File tree

9 files changed

+61
-52
lines changed

9 files changed

+61
-52
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/bower_components/
66
/node_modules/
77
/output/
8+
package-lock.json

LICENSE

+22-16
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1-
The MIT License (MIT)
1+
Copyright 2018 PureScript
22

3-
Copyright (c) 2014 PureScript
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
45

5-
Permission is hereby granted, free of charge, to any person obtaining a copy of
6-
this software and associated documentation files (the "Software"), to deal in
7-
the Software without restriction, including without limitation the rights to
8-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9-
the Software, and to permit persons to whom the Software is furnished to do so,
10-
subject to the following conditions:
6+
1. Redistributions of source code must retain the above copyright notice, this
7+
list of conditions and the following disclaimer.
118

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
9+
2. Redistributions in binary form must reproduce the above copyright notice,
10+
this list of conditions and the following disclaimer in the documentation and/or
11+
other materials provided with the distribution.
1412

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
3. Neither the name of the copyright holder nor the names of its contributors
14+
may be used to endorse or promote products derived from this software without
15+
specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

bower.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "purescript-globals",
33
"homepage": "https://github.com/purescript/purescript-globals",
44
"description": "Typed definitions for standard Javascript globals",
5-
"license": "MIT",
5+
"license": "BSD-3-Clause",
66
"repository": {
77
"type": "git",
88
"url": "git://github.com/purescript/purescript-globals.git"
@@ -17,7 +17,7 @@
1717
"package.json"
1818
],
1919
"devDependencies": {
20-
"purescript-assert": "^3.0.0",
21-
"purescript-console": "^3.0.0"
20+
"purescript-assert": "^4.0.0",
21+
"purescript-console": "^4.0.0"
2222
}
2323
}

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
55
"build": "eslint src && pulp build -- --censor-lib --strict",
6-
"test": "pulp test"
6+
"test": "pulp test --check-main-type Effect.Effect"
77
},
88
"devDependencies": {
9-
"eslint": "^3.17.1",
10-
"pulp": "^10.0.4",
11-
"purescript-psa": "^0.5.0-rc.1",
12-
"rimraf": "^2.6.1"
9+
"eslint": "^4.19.1",
10+
"pulp": "^12.2.0",
11+
"purescript-psa": "^0.6.0",
12+
"rimraf": "^2.6.2"
1313
}
1414
}

src/Global.js

-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* globals exports */
22
"use strict";
33

4-
// module Global
5-
64
exports.nan = NaN;
75

86
exports.isNaN = isNaN;
@@ -18,8 +16,3 @@ exports.readInt = function (radix) {
1816
};
1917

2018
exports.readFloat = parseFloat;
21-
22-
exports.decodeURI = decodeURI;
23-
exports.encodeURI = encodeURI;
24-
exports.decodeURIComponent = decodeURIComponent;
25-
exports.encodeURIComponent = encodeURIComponent;

src/Global.purs

-12
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,3 @@ foreign import readInt :: Int -> String -> Number
1919

2020
-- | Parse a floating point value from a `String`
2121
foreign import readFloat :: String -> Number
22-
23-
-- | uri decoding
24-
foreign import decodeURI :: String -> String
25-
26-
-- | uri encoding
27-
foreign import encodeURI :: String -> String
28-
29-
-- | uri component decoding
30-
foreign import decodeURIComponent :: String -> String
31-
32-
-- | uri component encoding
33-
foreign import encodeURIComponent :: String -> String

src/Global/Unsafe.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* globals exports, JSON */
22
"use strict";
33

4-
// module Global.Unsafe
5-
64
exports.unsafeStringify = function (x) {
75
return JSON.stringify(x);
86
};
@@ -25,3 +23,7 @@ exports.unsafeToPrecision = function (digits) {
2523
};
2624
};
2725

26+
exports.unsafeDecodeURI = decodeURI;
27+
exports.unsafeEncodeURI = encodeURI;
28+
exports.unsafeDecodeURIComponent = decodeURIComponent;
29+
exports.unsafeEncodeURIComponent = encodeURIComponent;

src/Global/Unsafe.purs

+22-3
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,38 @@ module Global.Unsafe where
44
-- | to serialize functions returns undefined
55
foreign import unsafeStringify :: forall a. a -> String
66

7-
-- | Formats Number as a String with limited number of digits after the dot
7+
-- | Formats Number as a String with limited number of digits after the dot.
8+
-- |
89
-- | May throw RangeError if the number of digits is not within the allowed range
910
-- | (standard precision range is 0 to 20, but implementations may change it)
1011
foreign import unsafeToFixed :: Int -> Number -> String
1112

1213
-- | Formats Number as String in exponential notation limiting number of digits
13-
-- | after the decimal dot.
14+
-- | after the decimal dot.
15+
-- |
1416
-- | May throw RangeError if the number of digits is not within the allowed range
1517
-- | (standard precision range is 0 to 20, but implementations may change it)
1618
foreign import unsafeToExponential :: Int -> Number -> String
1719

18-
-- | Formats Number as String in fixed-point or exponential notation rounded
20+
-- | Formats Number as String in fixed-point or exponential notation rounded
1921
-- | to specified number of significant digits.
22+
-- |
2023
-- | May throw RangeError if the number of digits is not within the allowed range
2124
-- | (standard precision range is 0 to 100, but implementations may change it)
2225
foreign import unsafeToPrecision :: Int -> Number -> String
26+
27+
-- | URI decoding. May throw a `URIError` if given a value with undecodeable
28+
-- | escape sequences.
29+
foreign import unsafeDecodeURI :: String -> String
30+
31+
-- | URI encoding. May throw a `URIError` if given a value with unencodeable
32+
-- | characters.
33+
foreign import unsafeEncodeURI :: String -> String
34+
35+
-- | URI component decoding. May throw a `URIError` if given a value with
36+
-- | undecodeable escape sequences.
37+
foreign import unsafeDecodeURIComponent :: String -> String
38+
39+
-- | URI component encoding. May throw a `URIError` if given a value with
40+
-- | unencodeable characters.
41+
foreign import unsafeEncodeURIComponent :: String -> String

test/Test/Main.purs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ module Test.Main where
22

33
import Prelude
44

5-
import Control.Monad.Eff (Eff)
6-
import Control.Monad.Eff.Console (CONSOLE, log)
5+
import Effect (Effect)
6+
import Effect.Console (log)
77

88
import Global (readFloat, readInt, isFinite, infinity, nan, isNaN)
99
import Global.Unsafe (unsafeToPrecision, unsafeToExponential, unsafeToFixed)
1010

11-
import Test.Assert (ASSERT, assert)
11+
import Test.Assert (assert)
1212

13-
main :: Eff (console :: CONSOLE, assert :: ASSERT) Unit
13+
main :: Effect Unit
1414
main = do
1515
let num = 12345.6789
1616

0 commit comments

Comments
 (0)