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

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
cryogenian committed Jun 5, 2018
1 parent 4796f2d commit 32b060a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 24 deletions.
13 changes: 7 additions & 6 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
8 changes: 4 additions & 4 deletions src/Lunapark/API.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'

Expand Down
15 changes: 9 additions & 6 deletions src/Lunapark/Endpoint.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(..))

Expand Down Expand Up @@ -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)
4 changes: 3 additions & 1 deletion src/Lunapark/Error.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Lunapark/LunaparkF.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions src/Lunapark/Types.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 32b060a

Please sign in to comment.