ChrisPenner / ChrisPenner/slick-template

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

Open
#9 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
29
Forks
13
PR merge metrics
No merged PRs in 30d

Description

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

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in Main.hs at line 101, where buildPost calls cacheAction, and inspect the definitions or type signatures for both functions. Reproduce the failure with cabal install slick-template; done means the project compiles past the reported buildPost errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.