- Why use Shake? Shake lets you write large robust build systems, which deal properly with generated source files and run quickly. If you are writing a custom build system of any moderate size (more than a few rules) you should use Shake. The advantages over other build systems are detailed in the document Why choose Shake?.
- How do I use Shake? Shake is a Haskell library that you use to define your rules. The Shake manual provides a walk through of a small but realistic example, assuming no Haskell knowledge.
- Generated documentation for all functions, includes lots of examples.
- Blog posts detailing ongoing development work.
- Academic paper on the underlying principles behind Shake.
- Download the Haskell package from Hackage and install it using Cabal.
- Mailing list for any questions/bugs/thoughts on Shake. If you need more information and aren't sure where to start, use the mailing list.
- Questions can be asked on StackOverflow with the tag
@ndm_haskell) and I'll include a link on the website.
The code under https://github.com/ndmitchell/shake/tree/master/website combines fragments from https://github.com/ndmitchell/shake/tree/master/website/parts along with documentation from https://github.com/ndmitchell/shake/tree/master/docs to produce pages. Mostly custom code in the end, with Markdown to parse and convert the pages, followed by TagSoup to tweak them.
"ghc --make" reimplemented with Shake
ghc-shake This is a reimplementation of ghc --make using Shake. It's entirely one process, so unlike out-of-process Shake, you won't see any slowdown compared to --make if you compile with only one core. # What's the benefit? 1. You get faster rebuild checking, because Shake doesn't recompute the entire dependency graph (ghc --make must preprocess and parse all source code every time it loads.) 2. You can keep going even when one file fails to compile, making sure that anything can be built, is built. 3. You get all the nice Shake features, e.g. unchanging rebuilds and profiling. The profiling is really handy! # How do I use it? You'll need these two (somewhat hard to get) items: - GHC 8.0 - A customized version of Shake: https://github.com/ezyang/shake - Appropriately patched copies of all of Shake's dependencies to work with GHC 8.0. If you wait, these will probably work out; but at the time of writing I needed to pass --allow-newer=base,transformers,process to cabal to get all of the dependencies to install. One way to to get everything installed (assuming GHC 8.0 is in your path) is to run: git clone https://github.com/ezyang/shake (cd shake && cabal install --allow-newer=base,transformers,process) git clone https://github.com/ezyang/ghc-shake (cd ghc-shake && cabal install --allow-newer=base,transformers,process) This will enable usage of `ghc --frontend GhcShake`. We have a sample script 'ghc-shake' in our source directory which you can pass to Cabal as a `--with-ghc` argument, which will override the meaning of `--make` (however, you'll need to edit the `-plugin-package-db` arguments to accurately reflect your installation. If you're not building ghc-shake in place, deleting them should be good enough.) # What doesn't work 1. Re-linking detection across packages. See https://ghc.haskell.org/trac/ghc/ticket/10161 2. Profiling. See https://ghc.haskell.org/trac/ghc/ticket/11293 3. Linking things that are not executables 4. Recompilation after package database changes. (We do correctly pick up changes to external interface files, however.) 5. ghc-shake is not really lib-ified properly (it should be namespaced and given explicit exports). I'll do this eventually. 6. hs-boot loops don't work; we don't properly invalidate the EPS when we successfully compile the replacement for an hs file. If you need something, shout and I'll try to implement it.
- A build system – an alternative to make, Scons, Ant etc.
- Reliable and robust – having been relied on commercially for over five years.
- Powerful – letting you express the problem precisely and directly.
- Fast to run – both to build from scratch and to rebuild.
The original motivation behind the creation of Shake was to allow rules to discover additional dependencies after running previous rules, allowing the build system to generate files and then examine them to determine their dependencies – something that cannot be expressed directly in most build systems. However, now Shake is a suitable build tool even if you do not require that feature.
Click to read about why you should use Shake.
Haskell Stack, then type
stack install shake, then run
stack exec -- shake --demo. The final step will create a sample Shake build system and run it (you should see this output).
To write your own Shake build system, read the user manual and refer to the API documentation. Further documentation on specific topics, including more examples, is available from the FAQ. Shake build systems are Haskell programs, but can be treated as a powerful version of make with slightly funny syntax. The build system requires no significant Haskell knowledge, and is designed so that most features are accessible by learning the "Shake syntax", without any appreciation of what the underlying Haskell means.
Click to read the user manual.
You can ask questions on StackOverflow using the tag
shake-build-system. You can email the mailing list with anything about Shake. If you find a bug you can report it at the GitHub issue tracker. If your question needs to remain confidential you can email me, although any insights from your question won't be public, so the other approaches are preferred.
Ninja files, allowing integration with CMake and Meson. Shake can predict completion time, profile build systems and sanity check builds. Shake is based on a robust underlying theory from this academic paper. Shake is an open source project under the BSD license hosted on GitHub with a range of contributors.
- Standard Chartered have been using Shake since 2009, as described in the section 6 of the academic paper.
- factis research GmbH use Shake to compile their Checkpad MED application, as described in their blog post.
- Samplecount have been using Shake since 2012, as mentioned in their tweet, producing several open-source projects for working with Shake.
- CovenantEyes use Shake to build their Windows client, as mentioned in their tweet.
- Keystone Tower Systems has a robotic welder with a Shake build system plus Haskell code running in the control system, as mentioned in their tweet.
- FP Complete use Shake to create Docker images.
- Genomics Plc use Shake for the build system, their first major use of Haskell in the company.
- shake-language-c allows cross-compiling C, C++ and Objective-C code to various target platforms.
- shake-cpp is an abstraction layer for Shake, providing simple C++ rules.
- kansas-lava-shake provides a set of rules to work with Kansas Lava and compile down to Xilinx chips.
- avr-shake provides rules for building things with AVR Crosspack.
- shake-minify uses native Haskell code (no external
$PATHdependencies) to minify CSS and JS files.
- shake-pack uses bz2 lib on the system to tar and bzip compress given files.
- ToolCabal is a rewrite of Cabal using Shake as the dependency engine.
- ghc-make uses Shake to build programs with GHC, speeding up checking if the build is clean.
- GHC is in the process of migrating to a Shake-based build system.
- shake-install helps build a set of cabal packages in the correct order.
- Many articles from the author of Shake, covering ongoing development.
- Writing a simple Blog with Shake and Pandoc.
I'm a Haskell programmer who lives in Cambridge with my wife Emily and son Henry (who has grown up a little since the photo on the right was taken). I have a PhD in Computer Science from York University, working on making functional programs shorter, faster and safer. Since then I've worked with F# at Credit Suisse and Haskell/F#/C++ at Standard Chartered, taking the lessons of functional programming and applying them in finance. I'm a strong believer in the functional approach, finding the combination of conciseness, static-typing and testability to offer significant advantages. I've got a blog mostly about Haskell, and I'm also on Twitter, LinkedIn and GitHub. To get in touch email me at firstname.lastname@example.org.
Open Source ProjectsI develop a number of open source Haskell projects, all of which can be found at my Github page or on Hackage. I welcome both contributions via pull requests and bug reports via the GitHub issue trackers. Some of my more popular projects include:
- Shake - a library for writing build systems, an alternative to
- Hoogle - a Haskell API search engine, searching the standard Haskell libraries by function name and type signature.
- HLint - a tool that suggests stylistic improvements to Haskell code.
Papers and talksAll papers and talks are listed below, most recent first. Show all abstracts or citations.
Talk: Defining your own build system with Shake
Talk: Shake 'n' Bake
Talk: Building stuff with Shake
Talk: Gluing things together with Haskell
Talk: Colin's Industrial Influence
Paper: Shake Before Building - Replacing Make with Haskell
Talk: Hoogle: Finding Functions from Types
Talk: Shake: A Better Make
Paper: Rethinking Supercompilation
Paper: Deriving a Relationship from a Single Example
Paper: Losing Functions without Gaining Data
Talk: Supercompilation for Haskell
Paper: Hoogle Overview
Paper: Not All Patterns, But Enough - an automatic verifier for partial but sufficient pattern matching
Talk: Hoogle: Fast Type Searching
Thesis: Transformation and Analysis of Functional Programs
Talk: Instances for Free
Paper: A Supercompiler for Core Haskell
Talk: Detecting Pattern-Match Failures in Haskell
Paper: Deriving Generic Functions by Example
Paper: Uniform Boilerplate and List Processing
Paper: Supero: Making Haskell Faster
Talk: Yhc: Past, Present, Future
Talk: Faster Haskell
Talk: Transformation and Analysis of Haskell Source Code
Talk: Fastest Lambda First
Paper: Yhc.Core - from Haskell to Core
Talk: First Order Haskell
Talk: Ada: Generics
Paper: A Static Checker for Safe Pattern Matching in Haskell
Talk: Playing with Haskell Data
Talk: Haskell With Go Faster Stripes
Talk: Hat: Windows and WIMP
Talk: Catch, A Practical Tool
Talk: Catch, Lazy Termination
Paper: Visual Hat
Paper: Unfailing Haskell: A Static Checker for Pattern Matching
Paper: Qualifying Dissertation: Unfailing Haskell
Talk: Total Pasta
Talk: Termination checking for a lazy functional language
Talk: A New Parser