{"id":20055029,"url":"https://github.com/lukehoersten/hoersten-haskell-style-guide","last_synced_at":"2026-02-20T18:31:24.706Z","repository":{"id":26710899,"uuid":"30168140","full_name":"lukehoersten/hoersten-haskell-style-guide","owner":"lukehoersten","description":"Luke Hoersten's Haskell programming language style guide.","archived":false,"fork":false,"pushed_at":"2015-02-02T02:42:48.000Z","size":120,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T08:39:10.319Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukehoersten.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-02T02:38:27.000Z","updated_at":"2015-02-02T02:38:27.000Z","dependencies_parsed_at":"2022-08-18T00:55:10.922Z","dependency_job_id":null,"html_url":"https://github.com/lukehoersten/hoersten-haskell-style-guide","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lukehoersten/hoersten-haskell-style-guide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukehoersten%2Fhoersten-haskell-style-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukehoersten%2Fhoersten-haskell-style-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukehoersten%2Fhoersten-haskell-style-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukehoersten%2Fhoersten-haskell-style-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukehoersten","download_url":"https://codeload.github.com/lukehoersten/hoersten-haskell-style-guide/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukehoersten%2Fhoersten-haskell-style-guide/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29660022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":[],"created_at":"2024-11-13T12:45:28.027Z","updated_at":"2026-02-20T18:31:24.682Z","avatar_url":"https://github.com/lukehoersten.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hoersten Haskell Style Guide\n\nIn general, shorter functions and modules are preferred. If functions\nare more than five lines and modules more than five functions,\nconsider breaking them up into smaller functions and modules.\n\n[stylish-haskell][] is used where it has a default opinion and will be\nnoted in the following sections.\n\n## Indentation\n\nIndent four spaces, no tabs. A dangling `do` and `where` are indented\ntwo spaces (the only exception to four spaces).\n\n``` haskell\nmain =\n  do\n    foo\n    bar x\n  where\n    x = 1\n```\n\n## Line Length\n\nLoosely prefer 80 columns but readability should take precedence over\ncolumn length. Nesting more than three scopes (12 columns) should be\navoided.\n\n## Modules\n\nThe `where` should be on the same line as the module name unless there\nare exports.\n\n```haskell\nmodule Main where\n```\n\nA module with exports should be indented four spaces, one export per\nline, aligning the `(`, `)`, and `,`, ending with a space between the\nclosing `)` and `where`.\n\n```haskell\nmodule Main\n    ( foo\n    , bar\n    , baz\n    ) where\n```\n\nSection documentation should be aligned with the export names.\n\n```haskell\nmodule Main\n    ( -- * Section 1\n      foo\n    , bar\n\n      -- * Section 2\n    , baz\n    ) where\n```\n\n## Imports\n\nImports are *always* explicit or qualified.\n\nUse [stylish-haskell][] to organize imports. Unqualified imports are\nalways 11 spaces after the `import` keyword to line up with\n`qualified` imports. Import lists should all be aligned to the longest\nmodule name. Types should typically be used unqualified unless name\nconflicts.\n\n```haskell\nimport           Control.Applicative ((\u003c$\u003e))\nimport           System.Directory    (doesFileExist)\n\nimport           Data.Map            (Map, keys, (!))\nimport qualified Data.Map            as M\n```\n\n## Functions\n\nAll top level functions should have signatures and be separated by two\nlines.\n\n```haskell\nimport Data.List\n\n\nfoo :: IO ()\nfoo = do stuff\n\n\nbar :: IO ()\nbar = baz\n```\n\n## Types\n\nTwo spaces should separate all type declarations except one-line types\nlike `newtype`, `type`, and simple sum types. These can be packed\ntogether with other related single-line types.\n\n```haskell\ndata Z\n    = A\n    | B\n    | C\n    | deriving (Show)\n\n\ndata Bool = True | False deriving Show\nnewtype X = X { unX :: Int } deriving Show\ntype Y = Int\n```\n\nLonger sum types should align the `=`, `|`, and `deriving` with an\nindentation of four spaces.\n\n```haskell\ndata Weekdays\n    = Monday\n    | Tuesday\n    | Wednesday\n    | Thursday\n    | Friday\n    deriving (Show)\n```\n\nRecord types should be organized by [stylish-haskell][]. This means\nthe type and data constructors on the same line, and the `{`, `}`, and\n`,` aligned at four spaces with the `deriving` following the closing\nbracket. The field types should also be aligned.\n\n```haskell\ndata Point = Point\n    { pointX    :: Double\n    , pointName :: String\n    } deriving (Show)\n```\n\nRecord syntax should never be used within a sum type.\n\n## Spacing\n\nAlways space out multi-operator expressions.\n\n```haskell\nfoo = x y * z * y\n```\n\nAlways follow `,` in collections with a space.\n\n```haskell\n(a, b, c)\n[1, 2, 3]\n[(1, 2), (3, 4), (5, 6)]\n```\n\nIn record updates, do not separate field and value with spaces.\n\n```haskell\nlet rec' = rec{a=1, b=2, c=3}\n```\n\n\n[stylish-haskell]: https://github.com/jaspervdj/stylish-haskell\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukehoersten%2Fhoersten-haskell-style-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukehoersten%2Fhoersten-haskell-style-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukehoersten%2Fhoersten-haskell-style-guide/lists"}