Skip to content

Instantly share code, notes, and snippets.

@mmynsted
Created January 27, 2021 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmynsted/40d0d88d7fc67b69e1790c11aa95402e to your computer and use it in GitHub Desktop.
Save mmynsted/40d0d88d7fc67b69e1790c11aa95402e to your computer and use it in GitHub Desktop.
-- tsDefaultCompiler :: [Identifier] -> Context String -> Item String -> Compiler (Item String)
-- tsDefaultCompiler
siteIndexCompiler :: Context String -> Item String -> Compiler (Item String)
siteIndexCompiler ctx =
loadAndApplyTemplate "templates/site-index.html" ctx
>=> defaultCompiler ctx
sitePageCompiler :: Context String -> Item String -> Compiler (Item String)
sitePageCompiler ctx =
loadAndApplyTemplate "templates/site-page.html" ctx
>=> defaultCompiler ctx
defaultCompiler :: Context String -> Item String -> Compiler (Item String)
defaultCompiler ctx =
loadAndApplyTemplate "templates/default.html" ctx
>=> cleanAndRelUrls
@mmynsted
Copy link
Author

If I change the function like this

tsDefaultCompiler ::
    [Identifier] ->
    Context String ->
    Item String ->
    Compiler (Item String)
tsDefaultCompiler ts ctx =
    foldM
        (\acc b -> loadAndApplyTemplate b ctx)
        (empty :: Compiler (Item String))
        ts

Then it compiles but the result is always the empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment