Skip to content

Commit 5faac07

Browse files
Update to v0.14.0-rc3 v2 (#77)
Co-authored-by: Jordan Martinez <[email protected]>
1 parent 19305f0 commit 5faac07

File tree

6 files changed

+33
-29
lines changed

6 files changed

+33
-29
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515

1616
- name: Set up a PureScript toolchain
1717
uses: purescript-contrib/setup-purescript@main
18+
with:
19+
purescript: "0.14.0-rc3"
1820

1921
- name: Cache PureScript dependencies
2022
uses: actions/cache@v2

bower.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,26 @@
2424
"package.json"
2525
],
2626
"dependencies": {
27-
"purescript-web-html": "^2.0.0",
28-
"purescript-effect": "^2.0.0",
29-
"purescript-either": "^4.0.0",
30-
"purescript-globals": "^4.0.0",
31-
"purescript-lists": "^5.0.0",
32-
"purescript-maybe": "^4.0.0",
33-
"purescript-prelude": "^4.0.0",
34-
"purescript-semirings": "^5.0.0",
35-
"purescript-tuples": "^5.0.0",
36-
"purescript-validation": "^4.0.0",
37-
"purescript-aff": "^5.0.0",
38-
"purescript-control": "^4.0.0",
39-
"purescript-console": "^4.1.0",
40-
"purescript-integers": "^4.0.0",
41-
"purescript-foldable-traversable": "^4.0.0"
27+
"purescript-web-html": "master",
28+
"purescript-effect": "master",
29+
"purescript-either": "master",
30+
"purescript-lists": "master",
31+
"purescript-maybe": "master",
32+
"purescript-prelude": "master",
33+
"purescript-semirings": "master",
34+
"purescript-tuples": "master",
35+
"purescript-validation": "master",
36+
"purescript-aff": "master",
37+
"purescript-control": "master",
38+
"purescript-console": "master",
39+
"purescript-integers": "master",
40+
"purescript-js-uri": "https://github.com/purescript-contrib/purescript-js-uri.git#main",
41+
"purescript-foldable-traversable": "master"
4242
},
4343
"devDependencies": {
44-
"purescript-console": "^4.1.0",
45-
"purescript-assert": "^4.0.0",
46-
"purescript-record": "^2.0.0",
47-
"purescript-generics-rep": "^6.0.0"
44+
"purescript-console": "master",
45+
"purescript-assert": "master",
46+
"purescript-record": "master",
47+
"purescript-generics-rep": "master"
4848
}
4949
}

packages.dhall

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
let upstream =
2-
https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20201007/packages.dhall sha256:35633f6f591b94d216392c9e0500207bb1fec42dd355f4fecdfd186956567b6b
2+
https://raw.githubusercontent.com/purescript/package-sets/prepare-0.14/src/packages.dhall
33

44
in upstream

spago.dhall

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
, "either"
99
, "foldable-traversable"
1010
, "generics-rep"
11-
, "globals"
1211
, "integers"
12+
, "js-uri"
1313
, "lists"
1414
, "maybe"
15+
, "numbers"
16+
, "partial"
1517
, "prelude"
1618
, "psci-support"
1719
, "record"

src/Routing.purs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ module Routing
66
import Prelude
77

88
import Data.Either (Either)
9-
import Global.Unsafe (unsafeDecodeURIComponent)
9+
import Data.Maybe (fromJust)
10+
import JSURI (decodeURIComponent)
11+
import Partial.Unsafe(unsafePartial)
1012
import Routing.Match (Match, runMatch)
1113
import Routing.Parser (parse)
1214

1315
-- | Runs a `Match` parser.
1416
match :: forall a. Match a -> String -> Either String a
15-
match = matchWith unsafeDecodeURIComponent
17+
match = matchWith $ unsafePartial fromJust <<< decodeURIComponent
1618

1719
-- | Runs a `Match` parser given a custom String decoder.
1820
matchWith :: forall a. (String -> String) -> Match a -> String -> Either String a

src/Routing/Match.purs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import Data.String.NonEmpty (NonEmptyString)
1717
import Data.String.NonEmpty as NES
1818
import Data.Tuple (Tuple(..), snd)
1919
import Data.Validation.Semiring (V, invalid, unV)
20-
import Global (readFloat, isNaN)
20+
import Data.Number as Number
2121
import Routing.Match.Error (MatchError(..), showMatchError)
2222
import Routing.Types (Route, RoutePart(..))
2323

@@ -70,11 +70,9 @@ num :: Match Number
7070
num = Match \route ->
7171
case route of
7272
Cons (Path input) rs ->
73-
let res = readFloat input in
74-
if isNaN res then
75-
invalid $ free ExpectedNumber
76-
else
77-
pure $ Tuple rs res
73+
case Number.fromString input of
74+
Just res | not (Number.isNaN res) -> pure $ Tuple rs res
75+
_ -> invalid $ free ExpectedNumber
7876
_ ->
7977
invalid $ free ExpectedNumber
8078

0 commit comments

Comments
 (0)