@@ -1,12 +1,33 @@
11---
2−title: Using and writing Compilers
2+title: More on compilers: load, and templates
33author: Jasper Van der Jeugt
44---
55
6−Identifier, Item, Compiler
7−--------------------------
6+Loading items
7+-------------
88
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
10+the Hakyll library.
1011
11−- `Identifier` is a string-like value which uniquely identifies a single item
12− for your webpage
12+Suppose that you're generating `index.html` which shows your latest brilliant
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!
16+
17+Let's see some quick examples. We can load a specific item:
18+
19+```haskell
20+load "posts/foo.markdown" :: Compiler (Item String)
21+```
22+
23+Or a whole bunch of them:
24+
25+```haskell
26+loadAll "posts/*" :: Compiler [Item String]
27+```
28+
29+Sometimes you just want the *contents* and not the `Item`:
30+
31+```haskell
32+loadBody "posts/foo.markdown" :: Compiler String
33+```