Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from garyb/bump-dependencies
Browse files Browse the repository at this point in the history
Bump dependencies
  • Loading branch information
garyb authored Feb 28, 2019
2 parents 0f2e689 + 3f7f000 commit bf569de
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"dependencies": {
"purescript-xpath": "cryogenian/purescript-xpath#compiler/0.12",
"purescript-argonaut-core": "^4.0.0",
"purescript-argonaut-codecs": "^4.0.0",
"purescript-affjax": "^7.0.0",
"purescript-argonaut-codecs": "^5.1.2",
"purescript-affjax": "^8.0.0",
"purescript-css": "^4.0.0",
"purescript-node-fs-aff": "^6.0.0",
"purescript-run": "cryogenian/purescript-run#compiler/0.12"
Expand Down
4 changes: 2 additions & 2 deletions src/Lunapark/Endpoint.purs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Affjax.ResponseFormat as NR
import Affjax.StatusCode (StatusCode(..))
import Data.Argonaut.Core (Json)
import Data.Argonaut.Decode.Class (decodeJson) as J
import Data.Argonaut.Decode.Combinators ((.?)) as J
import Data.Argonaut.Decode.Combinators ((.:)) as J
import Data.Bifunctor (lmap)
import Data.Either (Either(..), either)
import Data.Foldable as F
Expand Down Expand Up @@ -174,7 +174,7 @@ handleAPIError
handleAPIError r = case r.status of
StatusCode 200 → lmap LE.unknownError do
obj ← J.decodeJson =<< lmap N.printResponseFormatError r.body
obj J..? "value"
obj J..: "value"
code →
Left $ either (LE.unknownError <<< N.printResponseFormatError) LE.fromJson r.body

Expand Down
10 changes: 5 additions & 5 deletions src/Lunapark/Error.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Lunapark.Error where
import Prelude

import Data.Argonaut.Core (Json) as J
import Data.Argonaut.Decode.Combinators ((.?)) as J
import Data.Argonaut.Decode.Combinators ((.:)) as J
import Data.Argonaut.Decode.Class (decodeJson) as J
import Data.Either (Either(..), either)

Expand Down Expand Up @@ -109,10 +109,10 @@ type Error =
fromJson J.Json Error
fromJson js = either unknownError identity do
obj ← J.decodeJson js
value ← obj J..? "value"
error ← fromStringCode =<< value J..? "error"
message ← value J..? "message"
stacktrace ← value J..? "stacktrace"
value ← obj J..: "value"
error ← fromStringCode =<< value J..: "error"
message ← value J..: "message"
stacktrace ← value J..: "stacktrace"
pure { error, message, stacktrace }

unknownError String Error
Expand Down
46 changes: 23 additions & 23 deletions src/Lunapark/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Control.Alt ((<|>))
import Data.Argonaut.Core (Json)
import Data.Argonaut.Core (Json, jsonEmptyObject, jsonNull) as J
import Data.Argonaut.Decode.Class (decodeJson) as J
import Data.Argonaut.Decode.Combinators ((.?))
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
Expand Down Expand Up @@ -59,7 +59,7 @@ derive newtype instance ordElement ∷ Ord Element

decodeElement Json Either String Element
decodeElement = J.decodeJson >=> \obj →
map Element $ obj .? "element-6066-11e4-a52e-4f735466cecf" <|> obj .? "ELEMENT"
map Element $ obj .: "element-6066-11e4-a52e-4f735466cecf" <|> obj .: "ELEMENT"

encodeElement Element Json
encodeElement (Element eid) = J.encodeJson $ FO.fromFoldable
Expand All @@ -77,8 +77,8 @@ type CreateSessionResponse =

decodeCreateSessionResponse Json Either String CreateSessionResponse
decodeCreateSessionResponse = J.decodeJson >=> \obj → do
session ← decodeSessionId =<< obj .? "sessionId"
capabilities ← decodeCapabilities =<< obj .? "capabilities"
session ← decodeSessionId =<< obj .: "sessionId"
capabilities ← decodeCapabilities =<< obj .: "capabilities"
pure { session, capabilities }

type ServerStatus =
Expand All @@ -87,7 +87,7 @@ type ServerStatus =
}

decodeServerStatus Json Either String ServerStatus
decodeServerStatus = J.decodeJson >=> \obj → { ready: _, message: _ } <$> obj .? "ready" <*> obj .? "message"
decodeServerStatus = J.decodeJson >=> \obj → { ready: _, message: _ } <$> obj .: "ready" <*> obj .: "message"

type Timeouts =
{ script Milliseconds
Expand All @@ -97,9 +97,9 @@ type Timeouts =

decodeTimeouts Json Either String Timeouts
decodeTimeouts = J.decodeJson >=> \obj → do
script ← map Milliseconds $ obj .? "script"
pageLoad ← map Milliseconds $ obj .? "pageLoad"
implicit ← map Milliseconds $ obj .? "implicit"
script ← map Milliseconds $ obj .: "script"
pageLoad ← map Milliseconds $ obj .: "pageLoad"
implicit ← map Milliseconds $ obj .: "implicit"
pure { script, pageLoad, implicit }

encodeTimeouts Timeouts Json
Expand Down Expand Up @@ -142,20 +142,20 @@ type Rectangle =

decodeRectangle Json Either String Rectangle
decodeRectangle = J.decodeJson >=> \obj → do
width ← obj .? "width"
height ← obj .? "height"
x ← obj .? "x"
y ← obj .? "y"
width ← obj .: "width"
height ← obj .: "height"
x ← obj .: "x"
y ← obj .: "y"
pure { width, height, x, y }

decodeRectangleLegacy { size Json, position Json } Either String Rectangle
decodeRectangleLegacy { size, position } = do
sobj ← J.decodeJson size
pobj ← J.decodeJson position
x ← pobj .? "x"
y ← pobj .? "y"
width ← sobj .? "width"
height ← sobj .? "height"
x ← pobj .: "x"
y ← pobj .: "y"
width ← sobj .: "width"
height ← sobj .: "height"
pure { width, height, x, y }

encodeRectangleLegacy Rectangle { size Json, position Json }
Expand Down Expand Up @@ -254,13 +254,13 @@ encodeCookie r = J.encodeJson $ FO.fromFoldable

decodeCookie Json Either String Cookie
decodeCookie = J.decodeJson >=> \obj → do
name ← obj .? "name"
value ← obj .? "value"
path ← maybify $ obj .? "path"
domain ← maybify $ obj .? "domain"
secure ← maybify $ obj .? "secure"
httpOnly ← maybify $ obj .? "httpOnly"
expiry ← maybify $ obj .? "expiry"
name ← obj .: "name"
value ← obj .: "value"
path ← maybify $ obj .: "path"
domain ← maybify $ obj .: "domain"
secure ← maybify $ obj .: "secure"
httpOnly ← maybify $ obj .: "httpOnly"
expiry ← maybify $ obj .: "expiry"
pure
{ name
, value
Expand Down

0 comments on commit bf569de

Please sign in to comment.