Skip to content

Commit ac0a869

Browse files
Add fourmolu config and restyled (#1570)
* Add fourmolu config and restyled * neat * format a module * woof * nothx * Update persistent/Database/Persist/SqlBackend/Internal/Statement.hs Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Remove reference to stylish-haskell --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent c6aba87 commit ac0a869

File tree

7 files changed

+109
-52
lines changed

7 files changed

+109
-52
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ Before submitting your PR, check that you've:
22

33
- [ ] Documented new APIs with [Haddock markup](https://www.haskell.org/haddock/doc/html/index.html)
44
- [ ] Added [`@since` declarations](http://haskell-haddock.readthedocs.io/en/latest/markup.html#since) to the Haddock
5-
- [ ] Ran `stylish-haskell` on any changed files.
6-
- [ ] Adhered to the code style (see the `.editorconfig` file for details)
5+
- [ ] Ran `fourmolu` on any changed files (`restyled` will do this for you, so
6+
accept the suggested changes if it makes them)
7+
- [ ] Adhered to the code style (see the `.editorconfig` and `fourmolu.yaml` files for details)
78

89
After submitting your PR:
910

.github/workflows/restyled.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# .github/workflows/restyled.yml
2+
3+
name: Restyled
4+
5+
on:
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
restyled:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: restyled-io/actions/setup@v4
18+
- uses: restyled-io/actions/run@v4
19+
with:
20+
suggestions: true

.restyled.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
restylers:
2+
- fourmolu
3+
- stylish-haskell:
4+
enabled: false

.stylish-haskell.yaml

Lines changed: 0 additions & 40 deletions
This file was deleted.

development.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Style Guide
22

3-
## `stylish-haskell`
3+
## `fourmolu`
44

55
This repository uses
6-
[`stylish-haskell`](https://hackage.haskell.org/package/stylish-haskell) as an
7-
autoformatter. `stylish-haskell` is inherently limited, so it won't handle
8-
everything, but it will format import lists, extension lists, etc.
6+
[`fourmolu`](https://hackage.haskell.org/package/fourmolu) as an
7+
autoformatter.
98

109
## `editorconfig`
1110

fourmolu.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Number of spaces per indentation step
2+
indentation: 4
3+
4+
# Max line length for automatic line breaking
5+
column-limit: 80
6+
7+
# Styling of arrows in type signatures (choices: trailing, leading, or leading-args)
8+
function-arrows: leading
9+
10+
# How to place commas in multi-line lists, records, etc. (choices: leading or trailing)
11+
comma-style: leading
12+
13+
# Styling of import/export lists (choices: leading, trailing, or diff-friendly)
14+
import-export-style: leading
15+
16+
# Rules for grouping import declarations
17+
import-grouping: legacy
18+
19+
# Whether to full-indent or half-indent 'where' bindings past the preceding body
20+
indent-wheres: false
21+
22+
# Whether to leave a space before an opening record brace
23+
record-brace-space: false
24+
25+
# Number of spaces between top-level declarations
26+
newlines-between-decls: 1
27+
28+
# How to print Haddock comments (choices: single-line, multi-line, or multi-line-compact)
29+
haddock-style: single-line
30+
31+
# How to print module docstring
32+
haddock-style-module: null
33+
34+
# Styling of let blocks (choices: auto, inline, newline, or mixed)
35+
let-style: newline
36+
37+
# How to align the 'in' keyword with respect to the 'let' keyword (choices: left-align, right-align, or no-space)
38+
in-style: right-align
39+
40+
# Whether to put parentheses around a single constraint (choices: auto, always, or never)
41+
single-constraint-parens: always
42+
43+
# Whether to put parentheses around a single deriving class (choices: auto, always, or never)
44+
single-deriving-parens: always
45+
46+
# Whether to sort constraints
47+
sort-constraints: false
48+
49+
# Whether to sort derived classes
50+
sort-derived-classes: false
51+
52+
# Whether to sort deriving clauses
53+
sort-deriving-clauses: false
54+
55+
# Whether to place section operators (those that are infixr 0, such as $) in trailing position, continuing the expression indented below
56+
trailing-section-operators: true
57+
58+
# Output Unicode syntax (choices: detect, always, or never)
59+
unicode: never
60+
61+
# Give the programmer more choice on where to insert blank lines
62+
respectful: true
63+
64+
# Fixity information for operators
65+
fixities: []
66+
67+
# Module reexports Fourmolu should know about
68+
reexports: []
69+
70+
# Modules defined by the current Cabal package for import grouping
71+
local-modules: []
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
{-# language RankNTypes #-}
1+
{-# LANGUAGE RankNTypes #-}
22

33
module Database.Persist.SqlBackend.Internal.Statement where
44

5+
import Conduit
56
import Data.Acquire
6-
import Database.Persist.Types.Base
77
import Data.Int
8-
import Conduit
8+
import Database.Persist.Types.Base
99

1010
-- | A 'Statement' is a representation of a database query that has been
1111
-- prepared and stored on the server side.
1212
data Statement = Statement
1313
{ stmtFinalize :: IO ()
1414
, stmtReset :: IO ()
1515
, stmtExecute :: [PersistValue] -> IO Int64
16-
, stmtQuery :: forall m. MonadIO m
17-
=> [PersistValue]
18-
-> Acquire (ConduitM () [PersistValue] m ())
16+
, stmtQuery
17+
:: forall m
18+
. (MonadIO m)
19+
=> [PersistValue]
20+
-> Acquire (ConduitM () [PersistValue] m ())
1921
}

0 commit comments

Comments
 (0)