{"id":13471509,"url":"https://github.com/haskell/stylish-haskell","last_synced_at":"2026-04-08T13:31:16.765Z","repository":{"id":3281967,"uuid":"4322202","full_name":"haskell/stylish-haskell","owner":"haskell","description":"Haskell code prettifier","archived":false,"fork":false,"pushed_at":"2025-12-28T11:10:27.000Z","size":1251,"stargazers_count":1024,"open_issues_count":139,"forks_count":153,"subscribers_count":14,"default_branch":"main","last_synced_at":"2026-03-29T19:27:39.688Z","etag":null,"topics":["hacktoberfest","haskell","prettifier"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"Aimeast/GitCandy","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haskell.png","metadata":{"files":{"readme":"README.markdown","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2012-05-14T09:42:11.000Z","updated_at":"2026-03-22T18:02:52.000Z","dependencies_parsed_at":"2023-12-27T23:09:45.722Z","dependency_job_id":"6cc0ef1f-c0cd-4e1e-9dde-6cbfd5dd0a94","html_url":"https://github.com/haskell/stylish-haskell","commit_stats":{"total_commits":443,"total_committers":85,"mean_commits":5.211764705882353,"dds":0.3724604966139955,"last_synced_commit":"12c9118dabd2aca779d41e2ee5cc64312ab8046d"},"previous_names":["jaspervdj/stylish-haskell"],"tags_count":87,"template":false,"template_full_name":null,"purl":"pkg:github/haskell/stylish-haskell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fstylish-haskell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fstylish-haskell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fstylish-haskell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fstylish-haskell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haskell","download_url":"https://codeload.github.com/haskell/stylish-haskell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fstylish-haskell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31252838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-31T18:32:52.363Z","status":"ssl_error","status_checked_at":"2026-03-31T18:32:51.507Z","response_time":111,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["hacktoberfest","haskell","prettifier"],"created_at":"2024-07-31T16:00:45.993Z","updated_at":"2026-04-08T13:31:16.728Z","avatar_url":"https://github.com/haskell.png","language":"Haskell","readme":"## stylish-haskell\n\n\u003cimg src=\"./assets/Logo/SVG/RoundedLogo.svg\" width=\"100px\"\u003e\n\n![Stack Build Status](https://github.com/jaspervdj/stylish-haskell/workflows/CI/badge.svg)\n![Cabal Build Status](https://github.com/jaspervdj/stylish-haskell/workflows/Cabal/badge.svg)\n\n## Introduction\n\nA simple Haskell code prettifier. The goal is not to format all of the code in\na file, since I find those kind of tools often \"get in the way\". However,\nmanually cleaning up import statements etc. gets tedious very quickly.\n\nThis tool tries to help where necessary without getting in the way.\n\n## Installation\n\nYou can install it using `stack install stylish-haskell` or `cabal install stylish-haskell`.\n\nYou can also install it using your package manager:\n\n- Debian 9 or later: `apt-get install stylish-haskell`\n- Ubuntu 16.10 or later: `apt-get install stylish-haskell`\n- Arch Linux: `pacman -S stylish-haskell`\n\n## Features\n\n- Aligns and sorts `import` statements\n- Groups and wraps `{-# LANGUAGE #-}` pragmas, can remove (some) redundant\n  pragmas\n- Removes trailing whitespace\n- Aligns branches in `case` and fields in records\n- Converts line endings (customizable)\n- Replaces tabs by four spaces (turned off by default)\n- Replaces some ASCII sequences by their Unicode equivalents (turned off by\n  default)\n- Format data constructors and fields in records.\n\nFeature requests are welcome! Use the [issue tracker] for that.\n\n[issue tracker]: https://github.com/haskell/stylish-haskell/issues\n\n## Example\n\nTurns:\n\n```haskell\n{-# LANGUAGE ViewPatterns, TemplateHaskell #-}\n{-# LANGUAGE GeneralizedNewtypeDeriving,\n            ViewPatterns,\n    ScopedTypeVariables #-}\n\nmodule Bad where\n\nimport Control.Applicative ((\u003c$\u003e))\nimport System.Directory (doesFileExist)\n\nimport qualified Data.Map as M\nimport      Data.Map    ((!), keys, Map)\n\ndata Point = Point { pointX, pointY :: Double , pointName :: String} deriving (Show)\n```\n\ninto:\n\n```haskell\n{-# LANGUAGE GeneralizedNewtypeDeriving #-}\n{-# LANGUAGE ScopedTypeVariables        #-}\n{-# LANGUAGE TemplateHaskell            #-}\n\nmodule Bad where\n\nimport           Control.Applicative ((\u003c$\u003e))\nimport           System.Directory    (doesFileExist)\n\nimport           Data.Map            (Map, keys, (!))\nimport qualified Data.Map            as M\n\ndata Point = Point\n    { pointX, pointY :: Double\n    , pointName      :: String\n    } deriving (Show)\n```\n\n## Configuration\n\nThe tool is customizable to some extent. It tries to find a config file in the\nfollowing order:\n\n1. A file passed to the tool using the `-c/--config` argument\n2. `.stylish-haskell.yaml` in the current directory (useful for per-directory\n   settings)\n3. `.stylish-haskell.yaml` in the nearest ancestor directory (useful for\n   per-project settings)\n4. `stylish-haskell/config.yaml` in the platform’s configuration directory\n   (on Windows, it is %APPDATA%, elsewhere it defaults to `~/.config` and\n   can be overridden by the `XDG_CONFIG_HOME` environment variable;\n   useful for user-wide settings)\n5. `.stylish-haskell.yaml` in your home directory (useful for user-wide\n   settings)\n6. The default settings.\n\nUse `stylish-haskell --defaults \u003e .stylish-haskell.yaml` to dump a\nwell-documented default configuration to a file, this way you can get started\nquickly.\n\n## Record formatting\n\nBasically, stylish-haskell supports 4 different styles of records, controlled by `records`\nin the config file.\n\nHere's an example of all four styles:\n\n```haskell\n-- equals: \"indent 2\", \"first_field\": \"indent 2\"\ndata Foo a\n  = Foo\n      { a :: Int\n      , a2 :: String\n        -- ^ some haddock\n      }\n  | Bar\n      { b :: a\n      }\n  deriving (Eq, Show)\n  deriving (ToJSON) via Bar Foo\n\n-- equals: \"same_line\", \"first_field\": \"indent 2\"\ndata Foo a = Foo\n               { a :: Int\n               , a2 :: String\n                 -- ^ some haddock\n               }\n           | Bar\n               { b :: a\n               }\n  deriving (Eq, Show)\n  deriving (ToJSON) via Bar Foo\n\n-- equals: \"same_line\", \"first_field\": \"same_line\"\ndata Foo a = Foo { a :: Int\n                 , a2 :: String\n                   -- ^ some haddock\n                 }\n           | Bar { b :: a\n                 }\n  deriving (Eq, Show)\n  deriving (ToJSON) via Bar Foo\n\n-- equals: \"indent 2\", first_field: \"same_line\"\ndata Foo a\n  = Foo { a :: Int\n        , a2 :: String\n          -- ^ some haddock\n        }\n  | Bar { b :: a\n        }\n  deriving (Eq, Show)\n  deriving (ToJSON) via Bar Foo\n```\n\n## Editor integration\n\n### Haskell Language Server\n[Haskell Language Server(HLS)][HLS] includes a [plugin][HLS stylish-haskell Plugin]\nfor stylish-haskell. By changing the formatting provider option\n(`haskell.formattingProvider`) to `stylish-haskell` as described in\n[HLS options][HLS option], any editors that support [Language Server Protocol][LSP]\ncan use stylish-haskell for formatting.\n\n[HLS]: https://github.com/haskell/haskell-language-server\n[HLS option]: https://haskell-language-server.readthedocs.io/en/latest/configuration.html#language-specific-server-options\n[HLS stylish-haskell Plugin]: https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-stylish-haskell-plugin/src/Ide/Plugin/StylishHaskell.hs\n[LSP]: https://microsoft.github.io/language-server-protocol/\n\n### VIM integration\n\nSince it works as a filter it is pretty easy to integrate this with VIM.\n\nYou can call\n\n    :%!stylish-haskell\n\nand add a keybinding for it.\n\nOr you can define `formatprg`\n\n    :set formatprg=stylish-haskell\n\nand then use `gq`.\n\nAlternatively, [vim-autoformat] supports stylish-haskell. To have it\nautomatically reformat the files on save, add to your vimrc:\n\n```vim\nautocmd BufWrite *.hs :Autoformat\n\" Don't automatically indent on save, since vim's autoindent for haskell is buggy\nautocmd FileType haskell let b:autoformat_autoindent=0\n```\n\nThere are also plugins that run stylish-haskell automatically when you save a\nHaskell file:\n\n- [vim-stylish-haskell]\n- [vim-stylishask]\n\n[vim-stylish-haskell]: https://github.com/nbouscal/vim-stylish-haskell\n[vim-stylishask]: https://github.com/alx741/vim-stylishask\n\n### Emacs integration\n\n[haskell-mode] for Emacs supports `stylish-haskell`. For configuration,\nsee [the “Using external formatters” section][haskell-mode/format] of the\nhaskell-mode manual.\n\n[haskell-mode]: https://github.com/haskell/haskell-mode\n[haskell-mode/format]: http://haskell.github.io/haskell-mode/manual/latest/Autoformating.html\n\n### Atom integration\n\n[ide-haskell] for Atom supports `stylish-haskell`.\n\n[atom-beautify] for Atom supports Haskell using `stylish-haskell`.\n\n[ide-haskell]: https://atom.io/packages/ide-haskell\n[atom-beautify]: Https://atom.io/packages/atom-beautify\n\n### Visual Studio Code integration\n\n[stylish-haskell-vscode] for VSCode supports `stylish-haskell`.\n\n[stylish-haskell-vscode]: https://github.com/vigoo/stylish-haskell-vscode\n\n## Using with Continuous Integration\n\nYou can quickly grab the latest binary and run `stylish-haskell` like so:\n\n    curl -sL https://raw.github.com/haskell/stylish-haskell/master/scripts/latest.sh | sh -s .\n\nWhere the `.` can be replaced with the arguments you pass to `stylish-haskell`.\n\n## Credits\n\nWritten and maintained by Jasper Van der Jeugt.\n\nContributors:\n\n- Chris Done\n- Hiromi Ishii\n- Leonid Onokhov\n- Michael Snoyman\n- Mikhail Glushenkov\n- Beatrice Vergani\n- Paweł Szulc\n- Łukasz Gołębiewski\n- Felix Mulder\n","funding_links":[],"categories":["Haskell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell%2Fstylish-haskell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaskell%2Fstylish-haskell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell%2Fstylish-haskell/lists"}