Skip to content

Commit dc6c13b

Browse files
authored
Merge pull request #6 from jacereda/master
Updates for 0.11
2 parents 37b55a7 + b8c1ffb commit dc6c13b

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

bower.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
"package.json"
1717
],
1818
"dependencies": {
19-
"purescript-datetime": "^2.0.0",
20-
"purescript-exceptions": "^2.0.0",
21-
"purescript-foreign": "^3.0.0",
22-
"purescript-integers": "^2.0.0"
19+
"purescript-datetime": "^3.0.0",
20+
"purescript-exceptions": "^3.0.0",
21+
"purescript-foreign": "^4.0.0",
22+
"purescript-integers": "^3.0.0"
2323
},
2424
"devDependencies": {
25-
"purescript-assert": "^2.0.0",
26-
"purescript-console": "^2.0.0",
27-
"purescript-globals": "^2.0.0"
25+
"purescript-assert": "^3.0.0",
26+
"purescript-console": "^3.0.0",
27+
"purescript-globals": "^3.0.0"
2828
}
2929
}

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"private": true,
33
"scripts": {
44
"clean": "rimraf output && rimraf .pulp-cache",
5-
"build": "jshint src && jscs src && pulp build --censor-lib --strict",
5+
"build": "jshint src && jscs src && pulp build -- --censor-lib --strict",
66
"test": "pulp test"
77
},
88
"devDependencies": {
9-
"jscs": "^2.8.0",
10-
"jshint": "^2.9.1",
11-
"pulp": "^9.0.0",
12-
"purescript-psa": "^0.3.8",
13-
"rimraf": "^2.5.0"
9+
"jscs": "^2.11.0",
10+
"jshint": "^2.9.4",
11+
"pulp": "^11.0.0",
12+
"purescript-psa": "^0.5.0",
13+
"rimraf": "^2.6.1"
1414
}
1515
}

src/Data/JSDate.purs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Data.JSDate where
1010

1111
import Prelude
1212

13-
import Control.Monad.Eff (Eff)
13+
import Control.Monad.Eff (kind Effect, Eff)
1414
import Control.Monad.Eff.Exception (EXCEPTION)
1515

1616
import Data.Date as Date
@@ -19,19 +19,18 @@ import Data.DateTime as DateTime
1919
import Data.DateTime.Instant (Instant)
2020
import Data.DateTime.Instant as Instant
2121
import Data.Enum (fromEnum)
22-
import Data.Foreign (unsafeReadTagged)
23-
import Data.Foreign.Class (class IsForeign)
22+
import Data.Foreign (F, Foreign, unsafeReadTagged)
2423
import Data.Function.Uncurried (Fn2, runFn2)
2524
import Data.Int (toNumber)
2625
import Data.Maybe (Maybe(..))
2726
import Data.Time as Time
2827
import Data.Time.Duration (Milliseconds(..))
2928

3029
-- | The type of JavaScript `Date` objects.
31-
foreign import data JSDate :: *
30+
foreign import data JSDate :: Type
3231

33-
instance isForeignJSDate :: IsForeign JSDate where
34-
read = unsafeReadTagged "Date"
32+
readDate :: Foreign -> F JSDate
33+
readDate = unsafeReadTagged "Date"
3534

3635
-- | Checks whether a date value is valid. When a date is invalid, the majority
3736
-- | of the functions return `NaN`, `"Invalid Date"`, or throw an exception.
@@ -114,7 +113,7 @@ foreign import parse
114113

115114
-- | The effect type used when indicating the current machine's date/time locale
116115
-- | is used in computing a value.
117-
foreign import data LOCALE :: !
116+
foreign import data LOCALE :: Effect
118117

119118
-- | Returns the date as a number of milliseconds since 1970-01-01 00:00:00 UTC.
120119
getTime :: JSDate -> Number

test/Test/Main.purs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import Data.DateTime as DT
1010
import Data.Enum (toEnum)
1111
import Data.Either (isRight)
1212
import Data.Foreign (F, Foreign)
13-
import Data.Foreign.Class (read)
1413
import Data.JSDate as JSD
1514
import Data.Maybe (Maybe(..), fromJust)
1615
import Partial.Unsafe (unsafePartial)
@@ -24,8 +23,8 @@ foreign import myDate :: Foreign
2423
main :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT, locale :: JSD.LOCALE | eff) Unit
2524
main = do
2625

27-
log "Check IsForeign intance will read JS date values..."
28-
assert $ isRight $ runExcept $ read myDate :: F JSD.JSDate
26+
log "Checking that readDate will read JS date values..."
27+
assert $ isRight $ runExcept $ JSD.readDate myDate :: F JSD.JSDate
2928

3029
log "Checking that a UTC date constructed with sensible values is valid..."
3130
assert $ JSD.isValid $ JSD.jsdate defaultDateRecord

0 commit comments

Comments
 (0)