diff --git a/bower.json b/bower.json index 3710af0..4c6383b 100644 --- a/bower.json +++ b/bower.json @@ -24,11 +24,12 @@ "test" ], "dependencies": { - "purescript-affjax": "#compiler/0.12", - "purescript-argonaut": "cryogenian/purescript-argonaut#compiler/0.12", - "purescript-css": "justinwoo/purescript-css#compiler/0.12", - "purescript-node-fs-aff": "#compiler/0.12", - "purescript-run": "#compiler/0.12", - "purescript-xpath": "cryogenian/purescript-xpath#compiler/0.12" + "purescript-xpath": "cryogenian/purescript-xpath#compiler/0.12", + "purescript-argonaut-core": "^4.0.0", + "purescript-argonaut-codecs": "^4.0.0", + "purescript-affjax": "^6.0.0", + "purescript-css": "^4.0.0", + "purescript-node-fs-aff": "^6.0.0", + "purescript-run": "cryogenian/purescript-run#compiler/0.12" } } diff --git a/package.json b/package.json index 594017e..dd4e89f 100644 --- a/package.json +++ b/package.json @@ -2,16 +2,15 @@ "name": "purescript-lunapark", "private": true, "scripts": { - "build": "pulp build -- --censor-lib --strict --stash", + "build": "pulp build -- --strict --stash", "build:non-strict": "pulp build", - "bundle": "purs bundle \"output/**/*.js\" --output ./index.js --main Main --module Main", "ide": "purs ide server" }, "license": "Apache-2.0", "dependencies": { "chromedriver": "^2.37.0", - "pulp": "^12.0.1", - "purescript": "cryogenian/node-purescript-bin#master", + "pulp": "^12.2.0", + "purescript": "slamdata/node-purescript#0.12", "purescript-psa": "^0.6.0", "xhr2": "^0.1.4" } diff --git a/src/Lunapark/API.purs b/src/Lunapark/API.purs index 8a46be7..e710584 100644 --- a/src/Lunapark/API.purs +++ b/src/Lunapark/API.purs @@ -3,14 +3,14 @@ module Lunapark.API where import Prelude import Control.Monad.Rec.Class (class MonadRec) -import Data.Argonaut as J +import Data.Argonaut.Decode.Class as J import Data.Bifunctor (lmap) import Data.Either (Either(..), isRight) import Data.List (List(..), (:)) import Data.List as L import Data.Map as Map import Data.Maybe (Maybe(..)) -import Data.String as Str +import Data.String.CodeUnits as Str import Data.Time.Duration (Milliseconds(..)) import Data.Traversable as T import Data.Variant as V @@ -533,11 +533,11 @@ handleLunapark inp = case _ of let try' = do a ← try - R.liftEffect $ Ref.modify (Map.insert key true) inp.requestMapRef + R.liftEffect $ Ref.modify_ (Map.insert key true) inp.requestMapRef pure a fallback' = do a ← fallback - R.liftEffect $ Ref.modify (Map.insert key false) inp.requestMapRef + R.liftEffect $ Ref.modify_ (Map.insert key false) inp.requestMapRef pure a in catch try' \_ → fallback' diff --git a/src/Lunapark/Endpoint.purs b/src/Lunapark/Endpoint.purs index 84aaf71..278180a 100644 --- a/src/Lunapark/Endpoint.purs +++ b/src/Lunapark/Endpoint.purs @@ -8,8 +8,9 @@ module Lunapark.Endpoint where import Prelude import Effect.Aff (Aff) -import Data.Argonaut (Json) -import Data.Argonaut as J +import Data.Argonaut.Core (Json) +import Data.Argonaut.Decode.Combinators ((.?)) as J +import Data.Argonaut.Decode.Class (decodeJson) as J import Data.Bifunctor (lmap) import Data.Either (Either(..)) import Data.Foldable as F @@ -18,6 +19,8 @@ import Data.Maybe (Maybe(..)) import Data.Newtype (un) import Lunapark.Error as LE import Lunapark.Types as LT +import Network.HTTP.Affjax.Response as NR +import Network.HTTP.Affjax.Request as NQ import Network.HTTP.Affjax as N import Network.HTTP.StatusCode (StatusCode(..)) @@ -173,13 +176,13 @@ handleAPIError r = case r.status of code → Left $ LE.fromJson r.response get ∷ String → Endpoint → Aff (Either LE.Error Json) -get uri ep = map handleAPIError $ N.get (uri <> print ep) +get uri ep = map handleAPIError $ N.get NR.json (uri <> print ep) post ∷ String → Endpoint → Json → Aff (Either LE.Error Json) -post uri ep obj = map handleAPIError $ N.post (uri <> print ep) obj +post uri ep obj = map handleAPIError $ N.post NR.json (uri <> print ep) $ NQ.json obj post_ ∷ String → Endpoint → Aff (Either LE.Error Json) -post_ uri ep = map handleAPIError $ N.post' (uri <> print ep) (Nothing ∷ Maybe Unit) +post_ uri ep = map handleAPIError $ N.post' NR.json (uri <> print ep) Nothing delete ∷ String → Endpoint → Aff (Either LE.Error Json) -delete uri ep = map handleAPIError $ N.delete (uri <> print ep) +delete uri ep = map handleAPIError $ N.delete NR.json (uri <> print ep) diff --git a/src/Lunapark/Error.purs b/src/Lunapark/Error.purs index ffa9b48..a8131b4 100644 --- a/src/Lunapark/Error.purs +++ b/src/Lunapark/Error.purs @@ -2,7 +2,9 @@ module Lunapark.Error where import Prelude -import Data.Argonaut as J +import Data.Argonaut.Core as J +import Data.Argonaut.Decode.Combinators ((.?)) as J +import Data.Argonaut.Decode.Class (decodeJson) as J import Data.Either (Either(..), either) data ErrorType diff --git a/src/Lunapark/LunaparkF.purs b/src/Lunapark/LunaparkF.purs index be0abaa..8132ec3 100644 --- a/src/Lunapark/LunaparkF.purs +++ b/src/Lunapark/LunaparkF.purs @@ -2,7 +2,7 @@ module Lunapark.LunaparkF where import Prelude -import Data.Argonaut as J +import Data.Argonaut.Core as J import Data.Symbol (SProxy(..)) import Lunapark.Types as LT import Run as R diff --git a/src/Lunapark/Types.purs b/src/Lunapark/Types.purs index 1a1e6d2..0db5e4f 100644 --- a/src/Lunapark/Types.purs +++ b/src/Lunapark/Types.purs @@ -8,8 +8,12 @@ import Prelude import CSS.Render as CSSR import CSS.Selector as CSS import Control.Alt ((<|>)) -import Data.Argonaut (Json, (.?)) -import Data.Argonaut as J +import Data.Argonaut.Core (Json) +import Data.Argonaut.Core as J +import Data.Argonaut.Decode.Class (class DecodeJson, decodeJson) as J +import Data.Argonaut.Decode.Combinators ((.?)) +import Data.Argonaut.Encode.Class (class EncodeJson, encodeJson) as J +import Data.Argonaut.Encode.Combinators (extend) as J import Data.Array as A import Data.Either (Either(..)) import Data.Map as Map