Linux command
brittany 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Format file and output to stdout
brittany [source.hs]
Format from stdin
cat [source.hs] | brittany
Format files in place
brittany --write-mode=inplace [*.hs]
Check formatting without modifying
brittany --check-mode [source.hs]
Use specific config file
brittany --config-file [brittany.yaml] [source.hs]
Set column limit
brittany --columns [100] [source.hs]
说明
brittany is a Haskell source code formatter that focuses on horizontal space utilization. It reformats code to make maximal use of available width while avoiding lines that are too long. The formatter uses ghc-exactprint as the parser, supporting full GHC Haskell including extensions.
参数
- --write-mode _mode_
- Output mode: stdout, inplace, or display
- --check-mode
- Exit with error if formatting would change
- --columns _n_
- Maximum line width (default: 80)
- --indent _n_
- Indentation width (default: 2)
- --config-file _file_
- Use specific configuration file
- --no-user-config
- Ignore user configuration file
FAQ
What is the brittany command used for?
brittany is a Haskell source code formatter that focuses on horizontal space utilization. It reformats code to make maximal use of available width while avoiding lines that are too long. The formatter uses ghc-exactprint as the parser, supporting full GHC Haskell including extensions.
How do I run a basic brittany example?
Run `brittany [source.hs]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --write-mode _mode_ do in brittany?
Output mode: stdout, inplace, or display