Skip to content

Commit ef5e4c8

Browse files
Drop math; update Math imports (#94)
* Drop math; update Math imports * Add changelog entry * Fix test usage of math
1 parent 89799b7 commit ef5e4c8

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ New features:
1212
Bugfixes:
1313

1414
Other improvements:
15+
- Drop deprecated `math` dependency; update imports (#94 by @JordanMartinez)
1516

1617
## [v5.0.2](https://github.com/purescript/purescript-datetime/releases/tag/v5.0.2) - 2021-04-19
1718

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
"purescript-gen": "master",
2525
"purescript-integers": "master",
2626
"purescript-lists": "master",
27-
"purescript-math": "master",
2827
"purescript-maybe": "master",
2928
"purescript-newtype": "master",
29+
"purescript-numbers": "master",
3030
"purescript-ordered-collections": "master",
3131
"purescript-partial": "master",
3232
"purescript-prelude": "master",

src/Data/Interval/Duration/Iso.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ import Data.List (List(..), reverse, span, null)
1717
import Data.List.NonEmpty (fromList)
1818
import Data.List.Types (NonEmptyList)
1919
import Data.Map as Map
20+
import Data.Number as Number
2021
import Data.Maybe (Maybe(..), isJust)
2122
import Data.Monoid.Additive (Additive(..))
2223
import Data.Newtype (unwrap)
2324
import Data.Tuple (Tuple(..), snd)
24-
import Math as Math
2525

2626
newtype IsoDuration = IsoDuration Duration
2727

@@ -89,8 +89,8 @@ checkFractionalUse {asList} = case _.rest (span (snd >>> not isFractional) asLis
8989
Cons (Tuple c _) rest | checkRest rest -> pure (InvalidFractionalUse c)
9090
_ -> empty
9191
where
92-
isFractional a = Math.floor a /= a
93-
checkRest rest = unwrap (foldMap (snd >>> Math.abs >>> Additive) rest) > 0.0
92+
isFractional a = Number.floor a /= a
93+
checkRest rest = unwrap (foldMap (snd >>> Number.abs >>> Additive) rest) > 0.0
9494

9595
checkNegativeValues :: CheckEnv -> List Error
9696
checkNegativeValues {asList} = flip foldMap asList \(Tuple c num) ->

src/Data/Time.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ import Prelude
1414
import Data.Enum (fromEnum, toEnum)
1515
import Data.Int as Int
1616
import Data.Maybe (fromJust)
17+
import Data.Number as Number
1718
import Data.Newtype (unwrap)
1819
import Data.Time.Component (Hour, Millisecond, Minute, Second)
1920
import Data.Time.Duration (class Duration, Days(..), Milliseconds(..), fromDuration, negateDuration, toDuration)
2021
import Data.Tuple (Tuple(..))
21-
import Math as Math
2222
import Partial.Unsafe (unsafePartial)
2323

2424
data Time = Time Hour Minute Second Millisecond
@@ -77,7 +77,7 @@ adjust d t =
7777
d' = fromDuration d
7878
tLength = timeToMillis t
7979
dayLength = 86400000.0
80-
wholeDays = Days $ Math.floor (unwrap d' / dayLength)
80+
wholeDays = Days $ Number.floor (unwrap d' / dayLength)
8181
msAdjust = d' <> negateDuration (fromDuration wholeDays)
8282
msAdjusted = tLength <> msAdjust
8383
wrap = if msAdjusted > maxTime then 1.0 else if msAdjusted < minTime then -1.0 else 0.0
@@ -105,9 +105,9 @@ millisToTime (Milliseconds ms') =
105105
hourLength = 3600000.0
106106
minuteLength = 60000.0
107107
secondLength = 1000.0
108-
hours = Math.floor (ms' / hourLength)
109-
minutes = Math.floor ((ms' - hours * hourLength) / minuteLength)
110-
seconds = Math.floor ((ms' - (hours * hourLength + minutes * minuteLength)) / secondLength)
108+
hours = Number.floor (ms' / hourLength)
109+
minutes = Number.floor ((ms' - hours * hourLength) / minuteLength)
110+
seconds = Number.floor ((ms' - (hours * hourLength + minutes * minuteLength)) / secondLength)
111111
milliseconds = ms' - (hours * hourLength + minutes * minuteLength + seconds * secondLength)
112112
in
113113
unsafePartial fromJust $

test/Test/Main.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import Data.Interval as Interval
1414
import Data.Interval.Duration.Iso as IsoDuration
1515
import Data.Maybe (Maybe(..), fromJust)
1616
import Data.Newtype (over, unwrap)
17+
import Data.Number (floor)
1718
import Data.Time as Time
1819
import Data.Time.Duration as Duration
1920
import Data.Tuple (Tuple(..), snd)
20-
import Math (floor)
2121
import Partial.Unsafe (unsafePartial)
2222
import Test.Assert (assert)
2323
import Type.Proxy (Proxy(..))

0 commit comments

Comments
 (0)