Thought I might share something which I've found really useful.
If I define a helper like this... (I'm using the ANSI package to print with colors, but could be simpler)
dbgHelp : Task ok err, Bool -> Task ok err where ok implements Inspect
dbgHelp = \task, shouldDbgPrint ->
if shouldDbgPrint then
Task.await task \answer ->
Str.joinWith ["DEBUG:" |> Color.fg Blue, Inspect.toStr answer] " " |> Stderr.line!
Task.ok answer
else
task
I can use it like this.
user = Sql.getUser args |> dbgHelp! devMode
Basically, just a nice way to log the output of a task inline without adding too much additional ceremony.
Now just need a task to load shouldDbgPrint
so you don't have to thread it through the app
Last updated: Jul 06 2025 at 12:14 UTC