Skip to content

Commit 598b6aa

Browse files
authored
Merge branch 'master' into 1829-add-monadmask-monadcatch-to-delayed-io
2 parents 1b88d8f + 96ab0ee commit 598b6aa

File tree

131 files changed

+919
-861
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+919
-861
lines changed

.github/workflows/code-style.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Code style check
1+
name: Code style checks
22

33
concurrency:
44
group: formatting-${{ github.ref_name }}
@@ -13,11 +13,24 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout Code
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v5
1717
with:
1818
fetch-depth: 1
1919
- name: Install Nix
2020
uses: cachix/install-nix-action@v31
2121
- name: Check code formatting
2222
run: |
23-
nix develop '#haskellFormatter' --command fourmolu --mode=check --check-idempotence servant servant-*
23+
nix develop '#haskellFormatter' --command fourmolu --mode=check --check-idempotence servant servant-*
24+
25+
lint:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout Code
29+
uses: actions/checkout@v5
30+
with:
31+
fetch-depth: 1
32+
- name: Install Nix
33+
uses: cachix/install-nix-action@v31
34+
- name: Run hlint check
35+
run: |
36+
nix develop '#haskellLinter' --command hlint servant servant-*

.github/workflows/master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v5
3131
- uses: haskell-actions/setup@v2
3232
id: setup-haskell-cabal
3333
name: Setup Haskell

hlint.yaml renamed to .hlint.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,12 @@
4545
#
4646
# Generalise map to fmap, ++ to <>
4747
# - group: {name: generalise, enabled: true}
48+
#
49+
# Replace return with pure
50+
- group: {name: future, enabled: true}
4851

4952

5053
# Ignore some builtin hints
51-
- ignore: {name: Redundant do}
52-
- ignore: {name: Parse error}
53-
- ignore: {name: Use fmap}
54-
- ignore: {name: Use list comprehension}
55-
- ignore: {name: Use lambda-case}
56-
- ignore: {name: Eta reduce}
5754
# - ignore: {name: Use const, within: SpecialModule} # Only within certain modules
5855

5956

cabal.project

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,3 @@ if(impl(ghc >= 9.6.1))
7878

7979
package lzma
8080
flags: -pkgconfig
81-
82-
if impl (ghc >= 9.10)
83-
allow-newer: servant-openapi3:base
84-
85-
if impl (ghc >= 9.12)
86-
allow-newer: postgresql-simple:base
87-
allow-newer: postgresql-simple:template-haskell
88-
allow-newer: pipes-safe:base

changelog.d/pr-1835

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
synopsis: Re-export client authentication primitives from `servant-client`
2+
packages: servant-client-core, servant-client
3+
prs: #1835
4+
issues: #1834
5+
description: {
6+
Add `AuthClientData`, `AuthenticatedRequest`, and `mkAuthenticatedRequest` to the `Servant.Client.Core.Reexport` module, which is re-exported within `servant-client`.
7+
8+
This means that authenticated client requests can now be made using `servant-client` only, without an explicit dependency on `servant-client-core`.
9+
}

changelog.d/pr-1843

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
synopsis: Set `errBody` of `defaultErrorFormatters.notFoundErrorFormatter`
2+
packages: servant-server
3+
prs: #1843
4+
issues: #1790
5+
description: {
6+
Set `errBody` of `defaultErrorFormatters.notFoundErrorFormatter` to avoid an empty body.
7+
}

changelog.d/pr-1844

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
synopsis: Add support for `OperationId`
2+
packages: servant, servant-client, servant-docs, servant-server, servant-swagger
3+
prs: #1844
4+
issues: N/A
5+
description: {
6+
Add `OperationId`, which can direct code and docs generation.
7+
}

doc/cookbook/basic-auth/BasicAuth.lhs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ api :: Proxy API
7171
api = Proxy
7272

7373
server :: Server API
74-
server usr = return (site usr)
74+
server usr = pure (site usr)
7575
```
7676
7777
In order to protect our endpoint (`"mysite" :> Get '[JSON] Website`), we simply
@@ -105,10 +105,10 @@ checkBasicAuth db = BasicAuthCheck $ \basicAuthData ->
105105
password = decodeUtf8 (basicAuthPassword basicAuthData)
106106
in
107107
case Map.lookup username db of
108-
Nothing -> return NoSuchUser
108+
Nothing -> pure NoSuchUser
109109
Just u -> if pass u == password
110-
then return (Authorized u)
111-
else return BadPassword
110+
then pure (Authorized u)
111+
else pure BadPassword
112112
```
113113
114114
This check simply looks up the user in the "database" and makes sure the

doc/cookbook/basic-streaming/Streaming.lhs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ In other words, without streaming libraries.
88
- Some basic usage doesn't require usage of streaming libraries,
99
like `conduit`, `pipes`, `machines` or `streaming`.
1010
We have bindings for them though.
11-
- Similar example is bundled with each of our streaming library interop packages (see
11+
- Similar example is bundled with each of our streaming library interop packages (see
1212
[servant-pipes](https://github.com/haskell-servant/servant/blob/master/servant-pipes/example/Main.hs),
1313
[servant-conduit](https://github.com/haskell-servant/servant/blob/master/servant-conduit/example/Main.hs) and
1414
[servant-machines](https://github.com/haskell-servant/servant/blob/master/servant-machines/example/Main.hs))
1515
- `SourceT` doesn't have *Prelude* with handy combinators, so we have to write
16-
things ourselves. (Note to self: `mapM` and `foldM` would be handy to have).
16+
things ourselves. (Note to self: `mapM` and `foldM` would be handy to have).
1717

1818
## Code
1919

@@ -64,19 +64,19 @@ server :: Server API
6464
server = fast :<|> slow :<|> readme :<|> proxy where
6565
fast n = liftIO $ do
6666
putStrLn $ "/get/" ++ show n
67-
return $ fastSource n
67+
pure $ fastSource n
6868
6969
slow n = liftIO $ do
7070
putStrLn $ "/slow/" ++ show n
71-
return $ slowSource n
71+
pure $ slowSource n
7272

7373
readme = liftIO $ do
7474
putStrLn "/proxy"
75-
return (S.readFile "README.md")
75+
pure (S.readFile "README.md")
7676
7777
proxy c = liftIO $ do
7878
putStrLn "/proxy"
79-
return c
79+
pure c
8080

8181
-- for some reason unfold leaks?
8282
fastSource = S.fromStepT . mk where
@@ -116,8 +116,8 @@ main = do
116116
x <- S.unSourceT src (go (0 :: Int))
117117
print x
118118
where
119-
go !acc S.Stop = return acc
120-
go !acc (S.Error err) = print err >> return acc
119+
go !acc S.Stop = pure acc
120+
go !acc (S.Error err) = print err >> pure acc
121121
go !acc (S.Skip s) = go acc s
122122
go !acc (S.Effect ms) = ms >>= go acc
123123
go !acc (S.Yield _ s) = go (acc + 1) s

doc/cookbook/curl-mock/CurlMock.lhs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ generateEndpoint :: Text -> Req Mocked -> IO Text
141141
generateEndpoint host req =
142142
case maybeBody of
143143
Just body ->
144-
body >>= \b -> return $ T.intercalate " " [ "curl", "-X", method, "-d", "'" <> b <> "'"
144+
body >>= \b -> pure $ T.intercalate " " [ "curl", "-X", method, "-d", "'" <> b <> "'"
145145
, "-H 'Content-Type: application/json'", host <> "/" <> url ]
146146
Nothing ->
147-
return $ T.intercalate " " [ "curl", "-X", method, host <> "/" <> url ]
147+
pure $ T.intercalate " " [ "curl", "-X", method, host <> "/" <> url ]
148148
where
149149
method = decodeUtf8 $ req ^. reqMethod
150150

0 commit comments

Comments
 (0)