Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

how to effectively debug a hakyll configuration

19 views
Skip to first unread message

dukeofcool 199

unread,
Dec 18, 2024, 10:20:58 AM12/18/24
to hakyll
Howdy Hakyll folks,

I recently have started building out a website using hakyll!  During this journey I have run into a few pitfalls, but hey, such is life when trying to learn how to write haskell, as well as learn a new lib/framework at the same time.

Recently I tried to understand how to parse fields, items, etc. to define a list of link and label pairs in the front matter, for use in my site (is this impractical, probably, but I wanted to learn how to use hakyll).

My experience debugging this was sub par at best. I.e when building my feature, I wasn't sure what I was getting back from say the "lookupStringList" function.  And as a result, I had to go through a lot of shooting in the dark.

 I was wondering if this community would be willing to share techniques for being able to easily debug their hakyll configurations, particularly when trying to use more advanced parts of the library.

some examples of what I'm looking for (and keep in mind I'm very new to haskell, so I'm still learning that whole ecosystem)
* can I use the REPL to print out values that are picked up by hakyll?
* is there a way to easily insert "printf debugging" into the builder?
* is there a way to establish breakpoints and use some haskell debugger?

Hope everyone is having a rad day  :)

laurent....@gmail.com

unread,
Dec 19, 2024, 8:13:16 AM12/19/24
to hakyll
Hi there!


First off, hakyll has some form of logging. You can increase the verbosity using '--verbose' or '-v':

$ my-website build --verbose

This might help debug the core functionality provided by Hakyll, although logging could always be more informative.


To debug code that you wrote, I use the Debug.Trace module from the standard library extensively. This module provides various functions called trace* that can be used for printf-style debugging. 

I have never used a step-through debugger for Haskell, like you find in other languages.



Finally, if your website is stored in a public git repository, I'm happy to help set you up. Just shoot me an e-mail at <my first name in lowercase>.deco...@outlook.com


Laurent
Reply all
Reply to author
Forward
0 new messages