@@ -1,12 +1,33 @@
2−title: Using and writing Compilers
2+title: More on compilers: load, and templates
3author: Jasper Van der Jeugt
3author: Jasper Van der Jeugt
6−Identifier, Item, Compiler
6+Loading items
7−--------------------------
7+-------------
9−Three important, related types are `Identifier`, `Item` and `Compiler`.
9+The compiler Monad is a complex beast, but this is nicely hidden for the user of
11−- `Identifier` is a string-like value which uniquely identifies a single item
12+Suppose that you're generating `index.html` which shows your latest brilliant
12− for your webpage
13+blogpost. This requires `posts/foo.markdown` to be generated *before*
14+`index.html` (so we don't have to generate it twice). But you don't have to care
15+about all of that: Hakyll will sort this out this out for you automatically!
17+Let's see some quick examples. We can load a specific item:
20+load "posts/foo.markdown" :: Compiler (Item String)
23+Or a whole bunch of them:
26+loadAll "posts/*" :: Compiler [Item String]
29+Sometimes you just want the *contents* and not the `Item`:
32+loadBody "posts/foo.markdown" :: Compiler String