Haskell .gitignore template
The Haskell template ignores compiler object and interface files, both build tools' output directories, and the profiling and coverage data a run can leave behind.
At a glance
- Category
- Language
- Patterns in this template
- 23 rules
- Directories ignored
- 3 of the 23 rules end in a slash, so they match directories only
- Also needs an OS template
- Yes. Nothing in this template touches editor or file manager artefacts.
- Typical companions
- An editor template and an OS template.
In detail
The compiler emits an object file and an interface file for every module. *.o is the object, *.hi is the interface that records the module's exported types and signatures so dependent modules can be compiled without reparsing the source. The *.dyn_o and *.dyn_hi variants are the dynamically linked equivalents, and *.hie holds the extended syntax information that editor tooling reads. All five are derived and version specific.
dist and dist-* are the output directories for the standard build tool, with the suffixed variants coming from the newer per compiler layout. .stack-work is the equivalent for the other common build tool, holding compiled dependencies, generated cabal files and a full package database. cabal-dev and .cabal-sandbox are earlier isolation mechanisms that predate both.
cabal.project.local is where you record settings for your own checkout: which compiler to use, local package overrides, flags you enabled while debugging. It is the file that lets you deviate from the shared project definition, which is exactly why it should not be shared. The tilde suffixed variant is a backup of it.
The profiling rules cover *.prof, *.hp and *.eventlog. These are produced by running an executable built with profiling enabled: a cost centre report, a heap profile and an event log for the threaded runtime. They describe one run on one machine, and they get large quickly. .hpc holds coverage data from the same family of tools.
.ghc.environment.* files are written when you build outside a project context, recording which packages are visible to the compiler on this machine. *.chi and *.chs.h come from the C interface preprocessor, and *.aux is a leftover from the documentation toolchain.
Examples
dist
dist-*
cabal-dev
*.o
*.hi
*.hie
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*23 lines exactly as the tool writes them, before any common additions you tick.
Things that catch people out
- dist without a trailing slash matches a file named dist as well as the directory, which is harmless here but means the rule is broader than it reads.
- *.o overlaps with any C sources in the same repository, so a foreign function interface project sees both sets of object files covered by one rule.
- cabal.project is source and must stay tracked; only cabal.project.local is local. Deleting the .local suffix from the rule would ignore the shared project definition.
Try it: .gitignore Generator
Pick one or more templates, tick the common additions you want, and copy or download the combined .gitignore.
.gitignore Generator
LOCAL · Browser-OnlyGenerate comprehensive .gitignore files by combining templates for languages, frameworks, IDEs, and operating systems
Language
Framework
IDE
OS
Build Tool
Infrastructure
Common Additions
Preview
Select templates or common additions to generate a .gitignore file.
Related .gitignore templates
All .gitignore templates →Elixir .gitignore template
The Elixir template anchors its rules to the project root and ignores compiled beam files, fetched dependencies, crash dumps and the secret config convention.
Scala .gitignore template
What the Scala template ignores: the target output directory, the build server protocol folder, and the caches that Metals and Bloop keep inside the project.
C .gitignore template
What the C .gitignore template covers: object files, static and shared libraries, linker maps, debug symbols and the patterns that swallow a vendored binary.
Jupyter Notebook .gitignore template
The Jupyter template ignores autosave checkpoints and profile folders, but the real problem with notebooks in git is the output cells, which no rule fixes.
Laravel .gitignore template
The Laravel template ignores environment files, application keys, compiled assets and editor folders, and it is the most secret aware template here.
Node.js .gitignore template
The longest JavaScript oriented template: dependency directories, every package manager's debug log, bundler caches, env files and Yarn Plug'n'Play state.
Tools for this
- .gitignore Generator Generate .gitignore files for any project - 50+ templates for languages, frameworks, IDEs, and OS