From fac30722478c6de34a1e9476fd66db19095379af Mon Sep 17 00:00:00 2001 From: Jorge Acereda Date: Mon, 3 Apr 2017 00:47:50 +0200 Subject: [PATCH 1/2] Updates for 0.11 --- bower.json | 14 +++++++------- src/Data/JSDate.purs | 13 ++++++------- test/Test/Main.purs | 5 ++--- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/bower.json b/bower.json index 8ca6ade..f58f7ee 100644 --- a/bower.json +++ b/bower.json @@ -16,14 +16,14 @@ "package.json" ], "dependencies": { - "purescript-datetime": "^2.0.0", - "purescript-exceptions": "^2.0.0", - "purescript-foreign": "^3.0.0", - "purescript-integers": "^2.0.0" + "purescript-datetime": "^3.0.0", + "purescript-exceptions": "^3.0.0", + "purescript-foreign": "^4.0.0", + "purescript-integers": "^3.0.0" }, "devDependencies": { - "purescript-assert": "^2.0.0", - "purescript-console": "^2.0.0", - "purescript-globals": "^2.0.0" + "purescript-assert": "^3.0.0", + "purescript-console": "^3.0.0", + "purescript-globals": "^3.0.0" } } diff --git a/src/Data/JSDate.purs b/src/Data/JSDate.purs index 071ee09..d2e685e 100644 --- a/src/Data/JSDate.purs +++ b/src/Data/JSDate.purs @@ -10,7 +10,7 @@ module Data.JSDate where import Prelude -import Control.Monad.Eff (Eff) +import Control.Monad.Eff (kind Effect, Eff) import Control.Monad.Eff.Exception (EXCEPTION) import Data.Date as Date @@ -19,8 +19,7 @@ import Data.DateTime as DateTime import Data.DateTime.Instant (Instant) import Data.DateTime.Instant as Instant import Data.Enum (fromEnum) -import Data.Foreign (unsafeReadTagged) -import Data.Foreign.Class (class IsForeign) +import Data.Foreign (F, Foreign, unsafeReadTagged) import Data.Function.Uncurried (Fn2, runFn2) import Data.Int (toNumber) import Data.Maybe (Maybe(..)) @@ -28,10 +27,10 @@ import Data.Time as Time import Data.Time.Duration (Milliseconds(..)) -- | The type of JavaScript `Date` objects. -foreign import data JSDate :: * +foreign import data JSDate :: Type -instance isForeignJSDate :: IsForeign JSDate where - read = unsafeReadTagged "Date" +readDate :: Foreign -> F JSDate +readDate = unsafeReadTagged "Date" -- | Checks whether a date value is valid. When a date is invalid, the majority -- | of the functions return `NaN`, `"Invalid Date"`, or throw an exception. @@ -114,7 +113,7 @@ foreign import parse -- | The effect type used when indicating the current machine's date/time locale -- | is used in computing a value. -foreign import data LOCALE :: ! +foreign import data LOCALE :: Effect -- | Returns the date as a number of milliseconds since 1970-01-01 00:00:00 UTC. getTime :: JSDate -> Number diff --git a/test/Test/Main.purs b/test/Test/Main.purs index d26b11c..ebfbe89 100644 --- a/test/Test/Main.purs +++ b/test/Test/Main.purs @@ -10,7 +10,6 @@ import Data.DateTime as DT import Data.Enum (toEnum) import Data.Either (isRight) import Data.Foreign (F, Foreign) -import Data.Foreign.Class (read) import Data.JSDate as JSD import Data.Maybe (Maybe(..), fromJust) import Partial.Unsafe (unsafePartial) @@ -24,8 +23,8 @@ foreign import myDate :: Foreign main :: forall eff. Eff (console :: CONSOLE, assert :: ASSERT, locale :: JSD.LOCALE | eff) Unit main = do - log "Check IsForeign intance will read JS date values..." - assert $ isRight $ runExcept $ read myDate :: F JSD.JSDate + log "Checking that readDate will read JS date values..." + assert $ isRight $ runExcept $ JSD.readDate myDate :: F JSD.JSDate log "Checking that a UTC date constructed with sensible values is valid..." assert $ JSD.isValid $ JSD.jsdate defaultDateRecord From b8c1ffb0ef002704784f4d990468b9f23eec3678 Mon Sep 17 00:00:00 2001 From: Jorge Acereda Date: Mon, 3 Apr 2017 00:59:07 +0200 Subject: [PATCH 2/2] Update CI stuff --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 44534d6..c477226 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,14 @@ "private": true, "scripts": { "clean": "rimraf output && rimraf .pulp-cache", - "build": "jshint src && jscs src && pulp build --censor-lib --strict", + "build": "jshint src && jscs src && pulp build -- --censor-lib --strict", "test": "pulp test" }, "devDependencies": { - "jscs": "^2.8.0", - "jshint": "^2.9.1", - "pulp": "^9.0.0", - "purescript-psa": "^0.3.8", - "rimraf": "^2.5.0" + "jscs": "^2.11.0", + "jshint": "^2.9.4", + "pulp": "^11.0.0", + "purescript-psa": "^0.5.0", + "rimraf": "^2.6.1" } }