Skip to content
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
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# http://editorconfig.org
root = true

[Makefile]
indent_style = tabs
indent_size = 8
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{hs,md}]
indent_style = space
indent_size = 4
tab_width = 4
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fite me

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Before submitting your PR, check that you've:

- [ ] Documented new APIs with [Haddock markup](https://www.haskell.org/haddock/doc/html/index.html)
- [ ] Added [`@since` declarations](http://haskell-haddock.readthedocs.io/en/latest/markup.html#since) to the Haddock
- [ ] Ran `stylish-haskell` on any changed files.
- [ ] Adhered to the code style (see the `.editorconfig` file for details)

After submitting your PR:

Expand Down
39 changes: 39 additions & 0 deletions .stylish-haskell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
steps:
- imports:
align: none
list_align: with_module_name
pad_module_names: false
long_list_align: new_line_multiline
empty_list_align: inherit
list_padding: 7 # length "import "
separate_lists: false
space_surround: false
- language_pragmas:
style: vertical
align: false
remove_redundant: true
- simple_align:
cases: false
top_level_patterns: false
records: false
- trailing_whitespace: {}
indent: 4
columns: 80
newline: native
language_extensions:
- BlockArguments
- DataKinds
- DeriveGeneric
- DerivingStrategies
- DerivingVia
- ExplicitForAll
- FlexibleContexts
- MultiParamTypeClasses
- NamedFieldPuns
- OverloadedStrings
- QuantifiedConstraints
- RecordWildCards
- ScopedTypeVariables
- TemplateHaskell
- TypeApplications
- ViewPatterns
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,8 @@ Clone the repo and run `stack build` to build all targets. Persistent
supports many backends. If you have only some of these installed the
[development doc](development.md) shows how to build against a subset of
targets.

## Development

For more information on how to hack ont he `persistent` set of libraries, see
the [`development.md`](development.md) file.
27 changes: 26 additions & 1 deletion development.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# Style Guide

## `stylish-haskell`

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

## `editorconfig`

This repository has an `.editorconfig` file for use with the
[`EditorConfig`](https://editorconfig.org/) tool. It's recommended to install
the tool so that the editor style is picked up automatically.

## General Style Guide

Prefer 4 space indentation. If the line gets too long, refactor the code - pull
out named terms into `let` or `where` bindings (or top-level functions).

Prefer `case` expressions over combinators. Prefer `do` notation over combinators.
It's easier, simpler, and faster to read and modify these forms than more
concise versions, even where the more concise version is faster to write at
first.

# Building with Backends

With all required backends installed, `stack build` can build all packages
Expand All @@ -17,7 +42,7 @@ will fail as will builds for packages for those backends alone:
Process exited with code: ExitFailure 1
Configuring mysql-0.1.4...
setup: The program 'mysql_config' is required but it could not be found

> stack build persistent-postgresql
...
Process exited with code: ExitFailure 1
Expand Down