hakyll/web/tutorials/04-guide.markdown
2011-12-15 22:35:46 -05:00

4.5 KiB

title author
A Guide to the Hakyll Module Zoo Brent Yorgey

The hakyll package contains a bewildering array of modules, and it's hard to know where to look when you are just getting started---especially since many of them are only used by hakyll internally and not that useful to website authors. This guide provides a quick reference to the contents of the most important and useful modules.

Core modules

These are the modules containing the fundamental tools and concepts you need to get started building a site with hakyll.

  • Hakyll.Core.Compiler

    This is one of the modules you should look at first. It defines the fundamental Compiler type and has a bunch of documentation explaining how to use Compilers and their Arrow-based interface.

    It also defines many primitive Compilers as well as several variants on require, which allow you to bring together multiple resources to create a single output.

  • Hakyll.Core.Routes

    Specify where compiled items should go in the output site.

  • Hakyll.Core.Rules

    Specify which compilers and routes should be used on which resources.

    Also has combinators for grouping (necessary if you want to use the same resources for multiple purposes), creating outputs that are not based on any resources, and even dynamically generating compilers.

  • Hakyll.Core.Identifier.Pattern

    Combinators for creating patterns, i.e. predicates that pick out a set of resources: filesystem globs, arbitrary predicates, explicit lists, regular expressions, and so on.

  • Hakyll.Web.Page

    A Page, consisting of some metadata and a body, is one of the most fundamental structures used by hakyll. This module has some documentation explaining how pages work, and defines a number of compilers and utilities for working with them.

  • Hakyll.Web.Page.Metadata

    Utilities for manipulating page metadata.

  • Hakyll.Web.Template

    Templates specify how to take the content of a Page and turn it into HTML output.

  • Hakyll.Main

    The main hakyll function that runs the whole show. There is also a hakyllWith function which allows for a custom configuration.

Pre-packaged solutions

These modules contain some "pre-packaged" solutions for common situations. They can be used as-is, or their source can be used as inspiration for your own tools.

Useful utilities

  • Hakyll.Core.UnixFilter

    Use any unix utility as a compiler.

  • Hakyll.Core.Util.Arrow

    A few utilities for working with arrows, including a constant arrow, unit arrow, and running an entire list of arrows on a single input.

  • Hakyll.Core.Util.File

    Utility functions for working with the file system.

  • Hakyll.Core.Util.String

    A few utility functions for working with Strings (trim spaces, find and replace, split on regexp).

  • Hakyll.Core.Writable.WritableTuple

    A utility type covering the situation where you generate some data, some of which you want to write to disk, and some of which you don't want to write but will be needed in order to generate something else later.

Advanced customization

  • Hakyll.Core.Writable

    The Writable class is for resources which can be written to disk as part of the output site. You can specify how to write your own custom types to disk by giving them a Writable instance.

  • Hakyll.Web.Pandoc

    Some compilers for running pandoc. Normally they are run automatically as part of, for example, pageCompiler; but sometimes it is useful to be able to run pandoc explicitly.