{"id":13647087,"url":"https://github.com/mihaimaruseac/hindent","last_synced_at":"2026-04-06T03:36:17.640Z","repository":{"id":37988657,"uuid":"23284173","full_name":"mihaimaruseac/hindent","owner":"mihaimaruseac","description":"Haskell pretty printer","archived":false,"fork":false,"pushed_at":"2025-05-05T19:46:25.000Z","size":2279,"stargazers_count":568,"open_issues_count":38,"forks_count":114,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-09T09:08:30.319Z","etag":null,"topics":["code-formatter","hacktoberfest","haskell"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mihaimaruseac.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"patreon":"chrisdone"}},"created_at":"2014-08-24T15:16:00.000Z","updated_at":"2025-04-29T15:32:28.000Z","dependencies_parsed_at":"2023-10-27T18:32:43.620Z","dependency_job_id":"2052a4dc-c92d-4e25-931d-93df61a0f82f","html_url":"https://github.com/mihaimaruseac/hindent","commit_stats":{"total_commits":1419,"total_committers":77,"mean_commits":"18.428571428571427","dds":0.7364341085271318,"last_synced_commit":"0500d8bb08824b8d42e50ce56227cba66dac4d32"},"previous_names":["commercialhaskell/hindent"],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaimaruseac%2Fhindent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaimaruseac%2Fhindent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaimaruseac%2Fhindent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mihaimaruseac%2Fhindent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mihaimaruseac","download_url":"https://codeload.github.com/mihaimaruseac/hindent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-formatter","hacktoberfest","haskell"],"created_at":"2024-08-02T01:03:19.985Z","updated_at":"2026-04-06T03:36:12.622Z","avatar_url":"https://github.com/mihaimaruseac.png","language":"Haskell","funding_links":["https://patreon.com/chrisdone"],"categories":["Haskell"],"sub_categories":[],"readme":"# hindent [![Hackage](https://img.shields.io/hackage/v/hindent.svg?style=flat)](https://hackage.haskell.org/package/hindent) [![Haskell Cabal](https://github.com/mihaimaruseac/hindent/actions/workflows/presubmit-cabal.yaml/badge.svg)](https://github.com/mihaimaruseac/hindent/actions/workflows/presubmit-cabal.yaml) [![Haskell Stack](https://github.com/mihaimaruseac/hindent/actions/workflows/presubmit-stack.yaml/badge.svg)](https://github.com/mihaimaruseac/hindent/actions/workflows/presubmit-stack.yaml) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/mihaimaruseac/hindent/badge)](https://api.securityscorecards.dev/projects/github.com/mihaimaruseac/hindent)\n\nHaskell pretty printer\n\n[Examples](https://github.com/mihaimaruseac/hindent/blob/master/TESTS.md)\n\n## Install\n\n    $ stack install hindent\n\n## Usage\n\n    $ hindent --help\n    hindent - Reformat Haskell source code\n\n    Usage: hindent [--version | [--line-length ARG]\n                     [--indent-size ARG | --tab-size ARG] [--no-force-newline]\n                     [--sort-imports | --no-sort-imports] [--style STYLE]\n                     [-X GHCEXT] [--validate] [FILENAMES]]\n\n    Available options:\n      --version                Print the version\n      --line-length ARG        Desired length of lines (default: 80)\n      --indent-size ARG        Indentation size in spaces (default: 2)\n      --tab-size ARG           Same as --indent-size, for compatibility\n      --no-force-newline       Don't force a trailing newline\n      --sort-imports           Sort imports in groups\n      --no-sort-imports        Don't sort imports\n      --style STYLE            Style to print with (historical, now ignored)\n      -X GHCEXT                Language extension\n      --validate               Check if files are formatted without changing them\n      -h,--help                Show this help text\n\nhindent is used in a pipeline style\n\n    $ cat path/to/sourcefile.hs | hindent\n\nThe default indentation size is `2` spaces. Configure indentation size with `--indent-size`:\n\n    $ echo 'example = case x of Just p -\u003e foo bar' | hindent --indent-size 2; echo\n    example =\n      case x of\n        Just p -\u003e foo bar\n    $ echo 'example = case x of Just p -\u003e foo bar' | hindent --indent-size 4; echo\n    example =\n        case x of\n            Just p -\u003e foo bar\n\n## Customization\n\nCreate a `.hindent.yaml` file in your project directory or in your\n`~/` home directory. The following fields are accepted and are the\ndefault:\n\n``` yaml\nindent-size: 2\nline-length: 80\nforce-trailing-newline: true\nsort-imports: true\nline-breaks: []\nextensions: [\n    \"GHC2021\",\n    \"ListTuplePuns\",\n]\n```\n\nBy default, hindent preserves the newline or lack of newline in your input. With `force-trailing-newline`, it will make sure there is always a trailing newline.\n\nhindent can be forced to insert a newline before specific operators and tokens with `line-breaks`. This is especially useful when utilizing libraries like [`servant`](https://docs.servant.dev/) which use long type aliases.\n\nUsing `extensions`, hindent can be made aware of valid syntactic compiler extensions that would normally be considered invalid syntax.\n\nIt is also possible to specify which extensions HIndent runs\nwith in your `.hindent.yaml`:\n\n```yaml\nextensions:\n  - MagicHash\n  - RecursiveDo\n```\n\n## Emacs\n\nIn\n[elisp/hindent.el](https://github.com/mihaimaruseac/hindent/blob/master/elisp/hindent.el)\nthere is `hindent-mode`, which provides keybindings to reindent parts of the\nbuffer:\n\n- `M-q` reformats the current declaration.  When inside a comment, it fills the\n  current paragraph instead, like the standard `M-q`.\n- `C-M-\\` reformats the current region.\n\nTo enable it, add the following to your init file:\n\n```lisp\n(add-to-list 'load-path \"/path/to/hindent/elisp\")\n(require 'hindent)\n(add-hook 'haskell-mode-hook #'hindent-mode)\n```\n\n## Vim\n\nThe `'formatprg'` option lets you use an external program (like\nhindent) to format your text. Put the following line into\n~/.vim/ftplugin/haskell.vim to set this option for Haskell files:\n\n    setlocal formatprg=hindent\n\nThen you can format with hindent using `gq`. Read `:help gq` and `help\n'formatprg'` for more details.\n\nNote that unlike in emacs you have to take care of selecting a\nsensible buffer region as input to hindent yourself. If that is too\nmuch trouble you can try\n[vim-textobj-haskell](https://github.com/gilligan/vim-textobj-haskell)\nwhich provides a text object for top level bindings.\n\nIn order to format an entire source file execute:\n\n    :%!hindent\n\nAlternatively you could use the\n[vim-hindent](https://github.com/alx741/vim-hindent) plugin which runs hindent\nautomatically when a Haskell file is saved.\n\n## IntelliJ / other JetBrains IDEs\n1. Install the \"HaskForce\" Haskell plugin (this is so we get the language type recognized in the file watcher)\n2. Install the \"File Watchers\" plugin under \"Browse Repositories\"\n3. Add a File Watcher with\n    1. File type: Haskell Language\n    2. Program: `/path/to/hindent`\n    3. Arguments: `$FilePath$`\n    4. Immediate file synchronization: off\n    5. Show console: Error\n\u003cimg src=\"https://i.imgur.com/gghTjjn.png\" width=\"500\"\u003e\n\nNow whenever you save a file, `hindent` should autoformat it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihaimaruseac%2Fhindent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmihaimaruseac%2Fhindent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmihaimaruseac%2Fhindent/lists"}