From 81b8542319aaf6e134614fda60c23da4508e24b3 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 23 Oct 2020 12:16:15 -0700 Subject: [PATCH 1/4] Update TAG to v0.14.0-rc3; dependencies to master; psa to v0.8.0 --- .travis.yml | 2 +- bower.json | 10 +++++----- package.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4cbd5fd..74e7a30 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ node_js: stable env: - PATH=$HOME/purescript:$PATH install: - - TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p') + # - TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p') - wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz - tar -xvf $HOME/purescript.tar.gz -C $HOME/ - chmod a+x $HOME/purescript diff --git a/bower.json b/bower.json index 5c4b0ab..106c1aa 100644 --- a/bower.json +++ b/bower.json @@ -16,12 +16,12 @@ "output" ], "dependencies": { - "purescript-math": "^2.1.0", - "purescript-globals": "^4.0.0", - "purescript-maybe": "^4.0.0" + "purescript-math": "master", + "purescript-globals": "master", + "purescript-maybe": "master" }, "devDependencies": { - "purescript-console": "^4.2.0", - "purescript-assert": "^4.1.0" + "purescript-console": "master", + "purescript-assert": "master" } } diff --git a/package.json b/package.json index ed02c6f..18b5a31 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ }, "devDependencies": { "pulp": "^12.2.0", - "purescript-psa": "^0.6.0", + "purescript-psa": "^0.8.0", "rimraf": "^2.6.1" } } From e80f1a1905191452ee940c1d270bc30dbedf24ab Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 23 Oct 2020 12:18:38 -0700 Subject: [PATCH 2/4] Use curl instead of wget in .travis.yml to download purs binary --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 74e7a30..f6a6573 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,9 @@ node_js: stable env: - PATH=$HOME/purescript:$PATH install: - # - TAG=$(wget -q -O - https://github.com/purescript/purescript/releases/latest --server-response --max-redirect 0 2>&1 | sed -n -e 's/.*Location:.*tag\///p') + # - TAG=$(basename $(curl --location --silent --output /dev/null -w %{url_effective} https://github.com/purescript/purescript/releases/latest)) + - TAG=v0.14.0-rc3 + - curl --location --output $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz - wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz - tar -xvf $HOME/purescript.tar.gz -C $HOME/ - chmod a+x $HOME/purescript From de41d8006311af4c6d4c91f176118e10c9c64978 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 23 Oct 2020 12:21:31 -0700 Subject: [PATCH 3/4] Replace unicode syntax with ascii syntax --- src/Data/Number.purs | 10 +++++----- src/Data/Number/Approximate.purs | 10 +++++----- src/Data/Number/Format.purs | 16 ++++++++-------- test/Main.purs | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Data/Number.purs b/src/Data/Number.purs index 1b7a0bb..5706be3 100644 --- a/src/Data/Number.purs +++ b/src/Data/Number.purs @@ -39,24 +39,24 @@ import Global as G -- | > fromString " 1.2 ??" -- | (Just 1.2) -- | ``` -fromString ∷ String → Maybe Number +fromString :: String -> Maybe Number fromString = G.readFloat >>> check where check num | isFinite num = Just num | otherwise = Nothing -- | Not a number (NaN). -nan ∷ Number +nan :: Number nan = G.nan -- | Test whether a `Number` is NaN. -isNaN ∷ Number → Boolean +isNaN :: Number -> Boolean isNaN = G.isNaN -- | Positive infinity. -infinity ∷ Number +infinity :: Number infinity = G.infinity -- | Test whether a number is finite. -isFinite ∷ Number → Boolean +isFinite :: Number -> Boolean isFinite = G.isFinite diff --git a/src/Data/Number/Approximate.purs b/src/Data/Number/Approximate.purs index d3d2b00..0c3494e 100644 --- a/src/Data/Number/Approximate.purs +++ b/src/Data/Number/Approximate.purs @@ -41,7 +41,7 @@ newtype Fraction = Fraction Number -- | > (eqRelative (Fraction 0.01)) (0.1 + 0.2) 0.3 -- | true -- | ``` -eqRelative ∷ Fraction → Number → Number → Boolean +eqRelative :: Fraction -> Number -> Number -> Boolean eqRelative (Fraction frac) 0.0 y = abs y <= frac eqRelative (Fraction frac) x 0.0 = abs x <= frac eqRelative (Fraction frac) x y = abs (x - y) <= frac * abs (x + y) / 2.0 @@ -60,17 +60,17 @@ eqRelative (Fraction frac) x y = abs (x - y) <= frac * abs (x + y) / 2.0 -- | > 0.1 + 0.2 ≅ 0.3 -- | true -- | ``` -eqApproximate ∷ Number → Number → Boolean +eqApproximate :: Number -> Number -> Boolean eqApproximate = eqRelative onePPM where - onePPM ∷ Fraction + onePPM :: Fraction onePPM = Fraction 1.0e-6 infix 4 eqApproximate as ~= infix 4 eqApproximate as ≅ -- | The complement of `eqApproximate`. -neqApproximate ∷ Number → Number → Boolean +neqApproximate :: Number -> Number -> Boolean neqApproximate x y = not (x ≅ y) infix 4 neqApproximate as ≇ @@ -91,6 +91,6 @@ newtype Tolerance = Tolerance Number -- | > (eqAbsolute (Tolerance 0.1)) 133.7 133.0 -- | false -- | ``` -eqAbsolute ∷ Tolerance → Number → Number → Boolean +eqAbsolute :: Tolerance -> Number -> Number -> Boolean eqAbsolute (Tolerance tolerance) x y = abs (x - y) <= tolerance diff --git a/src/Data/Number/Format.purs b/src/Data/Number/Format.purs index f2ad641..6cf4080 100644 --- a/src/Data/Number/Format.purs +++ b/src/Data/Number/Format.purs @@ -30,9 +30,9 @@ module Data.Number.Format import Prelude -foreign import toPrecisionNative ∷ Int → Number → String -foreign import toFixedNative ∷ Int → Number → String -foreign import toExponentialNative ∷ Int → Number → String +foreign import toPrecisionNative :: Int -> Number -> String +foreign import toFixedNative :: Int -> Number -> String +foreign import toExponentialNative :: Int -> Number -> String -- | The `Format` data type specifies how a number will be formatted. data Format @@ -42,21 +42,21 @@ data Format -- | Create a `toPrecision`-based format from an integer. Values smaller than -- | `1` and larger than `21` will be clamped. -precision ∷ Int → Format +precision :: Int -> Format precision = Precision <<< clamp 1 21 -- | Create a `toFixed`-based format from an integer. Values smaller than `0` -- | and larger than `20` will be clamped. -fixed ∷ Int → Format +fixed :: Int -> Format fixed = Fixed <<< clamp 0 20 -- | Create a `toExponential`-based format from an integer. Values smaller than -- | `0` and larger than `20` will be clamped. -exponential ∷ Int → Format +exponential :: Int -> Format exponential = Exponential <<< clamp 0 20 -- | Convert a number to a string with a given format. -toStringWith ∷ Format → Number → String +toStringWith :: Format -> Number -> String toStringWith (Precision p) = toPrecisionNative p toStringWith (Fixed p) = toFixedNative p toStringWith (Exponential p) = toExponentialNative p @@ -73,4 +73,4 @@ toStringWith (Exponential p) = toExponentialNative p -- | > toString 1.2e-10 -- | "1.2e-10" -- | ``` -foreign import toString ∷ Number → String +foreign import toString :: Number -> String diff --git a/test/Main.purs b/test/Main.purs index ae50d27..f6387ee 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -15,13 +15,13 @@ import Test.Assert (assertTrue', assertFalse', assertEqual) -- | Comparison up to 10% relative error. -eqRelative' ∷ Number → Number → Boolean +eqRelative' :: Number -> Number -> Boolean eqRelative' = eqRelative (Fraction 0.1) infix 1 eqRelative' as ~= -- | Comparison up to 0.1 absolute error. -eqAbsolute' ∷ Number → Number → Boolean +eqAbsolute' :: Number -> Number -> Boolean eqAbsolute' = eqAbsolute (Tolerance 0.1) infix 1 eqAbsolute' as =~= From 542748d7ff5787b262abfc6419f3200cd7319d69 Mon Sep 17 00:00:00 2001 From: Jordan Martinez Date: Fri, 23 Oct 2020 15:04:50 -0700 Subject: [PATCH 4/4] Update pulp to v0.15.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18b5a31..c302773 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "test": "pulp test" }, "devDependencies": { - "pulp": "^12.2.0", + "pulp": "^15.0.0", "purescript-psa": "^0.8.0", "rimraf": "^2.6.1" }