https://github.com/icidasset/haskell-format
⚠️👨🔬 Experiment alert.
https://github.com/icidasset/haskell-format
formatter haskell parser
Last synced: 4 months ago
JSON representation
⚠️👨🔬 Experiment alert.
- Host: GitHub
- URL: https://github.com/icidasset/haskell-format
- Owner: icidasset
- License: bsd-3-clause
- Created: 2017-06-04T11:49:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T12:16:04.000Z (almost 8 years ago)
- Last Synced: 2024-10-12T11:23:16.712Z (over 1 year ago)
- Topics: formatter, haskell, parser
- Language: Haskell
- Size: 49.8 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Haskell Format
⚠️👨🔬 Experiment alert.
An opinionated Haskell source code parser and formatter.
## How to use
1. Git clone this repo somewhere
2. `stack install`
```shell
haskell-format path-to-haskell-file/Example.hs
# Or use it with stdin
haskell-format
INPUT
```
## What does this format exactly?
- [x] Comments
- [x] Exports & Imports
- [ ] Proper indentation of code (optional)
To see what it looks like, check the examples below
or browse through the code of this thing.
### Top-level comments
Whitespace will be inserted automatically between your top-level `--` comments and your code.
#### From
```haskell
foo = id
-- Constants
{- Bar -}
bar = "bar"
```
#### To
```haskell
foo = id
-- Constants
{- Bar -}
bar = "bar"
```
### Exports & Imports
Module exports will always be multiline and sorted by A-Z and then a-z. Imports will be sorted first by qualified or not qualified and then alphabetically.
#### From
```haskell
module Format (zulu, (~>), alpha, Type, Data(..)) where
import qualified A
import Z
import B
```
#### To
```haskell
module Format
( Data(..)
, Type
, (~>)
, alpha
, zulu
) where
import B
import Z
import qualified A
```