Skip to content

Instantly share code, notes, and snippets.

@mmynsted
Created September 30, 2020 18:17
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/0465fbc9f253231d7a04b1370b7e946f to your computer and use it in GitHub Desktop.
Save mmynsted/0465fbc9f253231d7a04b1370b7e946f to your computer and use it in GitHub Desktop.
makeTagFiles tags = \tag pattern -> (do
route idRoute
compile (do
posts <- recentFirst =<< loadAll pattern
let postsField = listField "posts" postCtx (pure posts)
let titleField = constField "title" ("Posts tagged \"" <> tag <> "\"")
let ctx = postCtxWithTags tags `mappend` postsField `mappend` titleField `mappend` siteCtx
makeItem ""
>>= loadAndApplyTemplate "templates/tag.html" ctx
>>= loadAndApplyTemplate "templates/default.html" ctx
>>= relativizeUrls))
@mmynsted
Copy link
Author

Why do I get a parse error from hlint? I have re-written this a bunch of times. This time I eliminated all use of $.

Found:
    --
    makeTagFiles :: Tags -> (String -> Pattern -> Rules ())
  > makeTagFiles tags = \tag pattern ->
        (do
            route idRoute

@mmynsted
Copy link
Author

Opps. Top line of the error message was missing from my comment.

 site.hs:183:26: Error: Parse error

@mmynsted
Copy link
Author

site.hs:183:26: Error: Parse error
Found:
    --
    makeTagFiles :: Tags -> (String -> Pattern -> Rules ())
  > makeTagFiles tags = \tag pattern ->
        (do
            route idRoute

@mmynsted
Copy link
Author

Okay with newer hlint I get:

Error: Parse error: on input `pattern'
Found:
    --
    makeTagFiles :: Tags -> (String -> Pattern -> Rules ())
  > makeTagFiles tags = \tag pattern ->
        (do
            route idRoute

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