From 4472391fbfb8de914146866f9c581e792984d1a0 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 11 Jul 2026 17:22:44 +0200 Subject: [PATCH 1/6] Add HTTP QUERY method --- src/Data/HTTP/Method.purs | 10 ++++++++-- test/Main.js | 3 +++ test/Main.purs | 25 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 test/Main.js create mode 100644 test/Main.purs diff --git a/src/Data/HTTP/Method.purs b/src/Data/HTTP/Method.purs index 3832af8..3a35ac6 100644 --- a/src/Data/HTTP/Method.purs +++ b/src/Data/HTTP/Method.purs @@ -12,8 +12,9 @@ import Data.Either (Either(..), either) import Data.String as Str -- | The definition of the type is based on HTTP/1.1 with --- | [RFC 2518](https://tools.ietf.org/html/rfc2518) and --- | [RFC 5789](https://tools.ietf.org/html/rfc5789). +-- | [RFC 2518](https://tools.ietf.org/html/rfc2518), +-- | [RFC 5789](https://tools.ietf.org/html/rfc5789), and +-- | [RFC 9842](https://www.rfc-editor.org/rfc/rfc9842). data Method -- HTTP/1.1 = OPTIONS @@ -37,6 +38,9 @@ data Method -- RFC5789 | PATCH + -- RFC 9842 + | QUERY + derive instance eqMethod :: Eq Method derive instance ordMethod :: Ord Method @@ -57,6 +61,7 @@ instance showMethod :: Show Method where show LOCK = "LOCK" show UNLOCK = "UNLOCK" show PATCH = "PATCH" + show QUERY = "QUERY" newtype CustomMethod = CustomMethod String @@ -91,6 +96,7 @@ parse handleMethod handleUnknown s = "LOCK" -> handleMethod LOCK "UNLOCK" -> handleMethod UNLOCK "PATCH" -> handleMethod PATCH + "QUERY" -> handleMethod QUERY m -> handleUnknown m fromString :: String -> Either Method CustomMethod diff --git a/test/Main.js b/test/Main.js new file mode 100644 index 0000000..a38ae41 --- /dev/null +++ b/test/Main.js @@ -0,0 +1,3 @@ +export const fail = message => () => { + throw new Error(message); +}; diff --git a/test/Main.purs b/test/Main.purs new file mode 100644 index 0000000..d3a852d --- /dev/null +++ b/test/Main.purs @@ -0,0 +1,25 @@ +module Test.Main where + +import Prelude + +import Data.Either (Either(..)) +import Data.HTTP.Method (Method(..), fromString, print, unCustomMethod) +import Effect (Effect) + +foreign import fail :: String -> Effect Unit + +assertEqual :: forall a. Eq a => Show a => String -> a -> a -> Effect Unit +assertEqual label expected actual = + unless (actual == expected) do + fail (label <> ": expected " <> show expected <> ", got " <> show actual) + +main :: Effect Unit +main = do + assertEqual "show QUERY" "QUERY" (show QUERY) + assertEqual "print QUERY" "QUERY" (print (Left QUERY)) + assertEqual "parse uppercase QUERY" (Left QUERY) (fromString "QUERY") + assertEqual "parse lowercase QUERY" (Left QUERY) (fromString "query") + assertEqual "parse mixed-case QUERY" (Left QUERY) (fromString "QuErY") + case fromString "FROB" of + Left method -> fail ("unknown method parsed as " <> show method) + Right custom -> assertEqual "unknown method" "FROB" (unCustomMethod custom) From 7449f7519e4202d66dafd2f627b2ab36d5413b4c Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 11 Jul 2026 17:30:15 +0200 Subject: [PATCH 2/6] Pin a working PureScript 0.15 package set --- packages.dhall | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages.dhall b/packages.dhall index 582d6d3..d84b93d 100644 --- a/packages.dhall +++ b/packages.dhall @@ -1,4 +1,5 @@ let upstream = - https://raw.githubusercontent.com/purescript/package-sets/prepare-0.15/src/packages.dhall + https://raw.githubusercontent.com/purescript/package-sets/psc-0.15.0-20220502/src/packages.dhall + sha256:38d347aeba9fe6359c208abe87a5cecf1ffb14294f11ad19664ae35c59b6e29a in upstream From b0dfc9ba887de23f69099aee3848a639d0f3e9c9 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 11 Jul 2026 17:46:43 +0200 Subject: [PATCH 3/6] Update deprecated GitHub Actions --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6887c57..a9370bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up a PureScript toolchain uses: purescript-contrib/setup-purescript@main @@ -20,7 +20,7 @@ jobs: purs-tidy: "latest" - name: Cache PureScript dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }} path: | From 984bbbce4854270d6dcd5f9e5fc2a20704be653f Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 11 Jul 2026 17:47:43 +0200 Subject: [PATCH 4/6] Pin the legacy Spago toolchain in CI --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9370bd..ea0767c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,8 @@ jobs: - name: Set up a PureScript toolchain uses: purescript-contrib/setup-purescript@main with: - purescript: "unstable" + purescript: "0.15.0" + spago: "0.20.9" purs-tidy: "latest" - name: Cache PureScript dependencies From c24929a0b90a4c7fa4a19ca9afd894be678be584 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 11 Jul 2026 17:49:15 +0200 Subject: [PATCH 5/6] Remove obsolete Pulp compiler flag --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea0767c..3034f20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: run: | npm install bower pulp@16.0.0-0 npx bower install - npx pulp build -- --censor-lib --strict + npx pulp build -- --strict if [ -d "test" ]; then npx pulp test fi From a1ffee45eb82a02d272cd407a1a9592be1202df4 Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 11 Jul 2026 17:50:39 +0200 Subject: [PATCH 6/6] Use supported Pulp compiler options --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3034f20..dc784f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: run: | npm install bower pulp@16.0.0-0 npx bower install - npx pulp build -- --strict + npx pulp build if [ -d "test" ]; then npx pulp test fi