Skip to content

errors in Main.hs - fuction buildPost - when installing anew #9

@reuleaux

Description

@reuleaux

I tried to (cabal) install slick-template, and in the last step, when ghc is compiling Main.hs,
I get two error messages about function buildPost (and cacheAction therein) being of the wrong type. I guess it's not a big thing, but I don't see what's going on yet, thanks.

/home/rx/work/site/Main.hs:101:21: error:
    • Couldn't match type ‘()’ with ‘Post’
      Expected type: Action Post
        Actual type: Action ()
    • In the expression:
        cacheAction ("build" :: T.Text, srcPath)
          $ do liftIO . putStrLn $ "Rebuilding post: " <> srcPath
               postContent <- readFile' srcPath
               postData <- markdownToHTML . T.pack $ postContent
               let postUrl = T.pack . dropDirectory1 $ srcPath -<.> "html"
                   withPostUrl = _Object . at "url" ?~ String postUrl
               ....
      In an equation for ‘buildPost’:
          buildPost srcPath
            = cacheAction ("build" :: T.Text, srcPath)
                $ do liftIO . putStrLn $ "Rebuilding post: " <> srcPath
                     postContent <- readFile' srcPath
                     postData <- markdownToHTML . T.pack $ postContent
                     ....
    |
101 | buildPost srcPath = cacheAction ("build" :: T.Text, srcPath) $ do
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...

/home/rx/work/site/Main.hs:101:33: error:
    • Couldn't match type ‘(T.Text, FilePath)’ with ‘[Char]’
      Expected type: String
        Actual type: (T.Text, FilePath)
    • In the first argument of ‘cacheAction’, namely
        ‘("build" :: T.Text, srcPath)’
      In the expression: cacheAction ("build" :: T.Text, srcPath)
      In the expression:
        cacheAction ("build" :: T.Text, srcPath)
          $ do liftIO . putStrLn $ "Rebuilding post: " <> srcPath
               postContent <- readFile' srcPath
               postData <- markdownToHTML . T.pack $ postContent
               let postUrl = T.pack . dropDirectory1 $ srcPath -<.> "html"
                   withPostUrl = _Object . at "url" ?~ String postUrl
               ....
    |
101 | buildPost srcPath = cacheAction ("build" :: T.Text, srcPath) $ do
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Compilation exited abnormally with code 1 at Thu May  7 21:43:02

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions