Skip to content

Update to v0.14.0-rc3 #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "0.14.0-rc3"

- uses: actions/setup-node@v1
with:
Expand Down
18 changes: 9 additions & 9 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"package.json"
],
"dependencies": {
"purescript-prelude": "^4.0.0",
"purescript-effect": "^2.0.0",
"purescript-http-methods": "^4.0.0",
"purescript-typelevel-prelude": "^5.0.0",
"purescript-web-file": "^2.3.0",
"purescript-record": "^2.0.0",
"purescript-foreign-object": "^2.0.0",
"purescript-web-promise": "https://github.com/purescript-web/purescript-web-promise.git#^1.0.0",
"purescript-web-streams": "https://github.com/purescript-web/purescript-web-streams.git#^1.0.0"
"purescript-prelude": "master",
"purescript-effect": "master",
"purescript-http-methods": "main",
"purescript-typelevel-prelude": "master",
"purescript-web-file": "master",
"purescript-record": "master",
"purescript-foreign-object": "master",
"purescript-web-promise": "https://github.com/purescript-web/purescript-web-promise.git#master",
"purescript-web-streams": "https://github.com/purescript-web/purescript-web-streams.git#master"
}
}
20 changes: 10 additions & 10 deletions src/Web/Fetch/Request.purs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ import Data.HTTP.Method (Method(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (un)
import Data.Nullable (Nullable, toNullable)
import Data.Symbol (class IsSymbol, SProxy(..))
import Data.Symbol (class IsSymbol)
import Data.Tuple (Tuple)
import Effect (Effect)
import Effect.Uncurried (EffectFn2, runEffectFn2)
import Foreign.Object (Object)
import Prim.Row as Row
import Prim.RowList (kind RowList)
import Prim.RowList (RowList)
import Prim.RowList as RowList
import Record (merge)
import Record.Builder as Record
import Type.Data.RowList (RLProxy(..))
import Type.Proxy (Proxy(..))
import Type.Row.Homogeneous (class Homogeneous)
import Web.Fetch.Headers (Headers)
import Web.Fetch.Headers as Headers
Expand Down Expand Up @@ -126,10 +126,10 @@ instance buildRequestOptionsRecord
, Row.Nub r'' RequestOptions
)
=> BuildRequestOptions { | r } where
buildRequestOptions r = merge (Record.build (convertOptions (RLProxy :: _ rl)) r) defaultOptions
buildRequestOptions r = merge (Record.build (convertOptions (Proxy :: _ rl)) r) defaultOptions

class ConvertOptions (rl :: RowList) (input :: # Type) (output :: # Type) | rl input -> output where
convertOptions :: RLProxy rl -> Record.Builder { | input } { | output }
class ConvertOptions (rl :: RowList Type) (input :: Row Type) (output :: Row Type) | rl input -> output where
convertOptions :: forall rlproxy. rlproxy rl -> Record.Builder { | input } { | output }

instance convertOptionsCons ::
( ConvertOptions rest input' output
Expand All @@ -139,14 +139,14 @@ instance convertOptionsCons ::
, IsSymbol field
) => ConvertOptions (RowList.Cons field from rest) input output where
convertOptions _ =
convertOptions (RLProxy :: _ rest)
<<< Record.modify (SProxy :: _ field) (convertOption (SProxy :: _ field))
convertOptions (Proxy :: _ rest)
<<< Record.modify (Proxy :: _ field) (convertOption (Proxy :: _ field))

instance convertOptionsNil :: ConvertOptions RowList.Nil r r where
convertOptions _ = identity

class ConvertOption (field :: Symbol) from to | field -> to where
convertOption :: SProxy field -> from -> to
convertOption :: forall sproxy. sproxy field -> from -> to

instance convertMethod :: ConvertOption "method" Method Method where
convertOption _ = identity
Expand Down Expand Up @@ -188,4 +188,4 @@ instance convertReferrerPolicy :: ConvertOption "referrerPolicy" ReferrerPolicy
convertOption _ = identity

instance convertIntegrity :: ConvertOption "integrity" Integrity Integrity where
convertOption _ = identity
convertOption _ = identity