   """
 
   import Serum.Payload
+
+  @type dirname   :: String.t
+  @type ok_result :: {:ok, dirname}
 
   @doc """
   Initializes a new Serum project into the given directory `dir`.

      IO.write(f, projinfo)
    end)
    IO.puts "Generated `#{dir}serum.json`."
    dir
  end

  defp init(dir, :page) do
    File.open!("#{dir}pages/index.md", [:write, :utf8], fn f ->
      IO.write(f, "*Hello, world!*\n")
    end)

      IO.write(f, tmp)
    end)
    IO.puts "Generated `#{dir}pages/pages.json`."
    {:ok, dir}
  end

  @docp """
  Generates default template files.
  """
  @spec init_templates(ok_result) :: ok_result
  defp init_templates({:ok, dir}) do
    %{base: template_base,
      nav:  template_nav,
      list: template_list,
