Stream: platform development

Topic: General Discussion


view this post on Zulip Luke Boswell (Dec 16 2024 at 09:23):

What would you prefer to see in the examples, try or ??

# (1)
Stdout.line!? "$(datetime) $(Inspect.toStr req.method) $(req.uri)"

# (2)
try Stdout.line! "$(datetime) $(Inspect.toStr req.method) $(req.uri)"

view this post on Zulip Luke Boswell (Dec 16 2024 at 09:24):

@Sam Mohr -- do you have any guidance here? Is there a more "future-proof" version?

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:26):

I expect try will go away, I'd vote for ?

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:26):

It's not as good now, but it's the parens function call plan

view this post on Zulip Luke Boswell (Dec 16 2024 at 09:34):

Screenshot 2024-12-16 at 20.34.14.png

It'd be nice if someone could update tree-sitter or the relevant syntax highlighting so the ? popped a little more

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:37):

I know @Eli Dowling has been waiting to make updates until after the deluge of syntax changes finishes

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:37):

But we can probably add an issue to the tree-sitter-roc repo that says we should highlight ! and ? as operators

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:38):

And then you can assign it to me

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:38):

I can't promise it'll get done this week, I'm still in choir throes, but it's an easy change IMO

view this post on Zulip Luke Boswell (Dec 16 2024 at 09:39):

Yeah I can see the value in holding off... but I'm also hoping this is a super minor change. But I have no idea how the tree sitter grammar's a like to update. Or the process to feed that back to zed or the editors

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:39):

I've done it before

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:39):

Nothing crazy

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:39):

If Zed is anything like Helix, you just need to feed it an updated commit SHA for the tree sitter repo

view this post on Zulip Sam Mohr (Dec 16 2024 at 09:40):

But maybe they use the latest commit by default? :woman_shrugging:

view this post on Zulip Richard Feldman (Dec 16 2024 at 12:18):

personally I'd prefer try until we switch to parens-and-commas

view this post on Zulip Richard Feldman (Dec 16 2024 at 12:19):

the main reason we added try was to avoid !? so I'd rather not have !? in the docs while we still have try and don't have parens-and-commas yet :big_smile:

view this post on Zulip Luke Boswell (Dec 17 2024 at 23:38):

Do you think it's important to add HTTP to basic-ssg?

view this post on Zulip Luke Boswell (Dec 17 2024 at 23:38):

I'm on the fence about adding these effects

view this post on Zulip Luke Boswell (Dec 17 2024 at 23:38):

Haven't thought much about it though

view this post on Zulip Luke Boswell (Dec 17 2024 at 23:39):

Like could you imagine using it in this? maybe fetch a json list of something?

main! : Args => Result {} _
main! = \{ inputDir, outputDir } ->

    # get the path and url of markdown files in content directory
    files = SSG.files!? inputDir

    # helper Task to process each file
    process_file! = \{ path, relpath, url } ->

        inHtml = SSG.parse_markdown!? path

        outHtml = transform_file_content url inHtml

        SSG.write_file! { outputDir, relpath, content: outHtml }

    ## process each file
    List.forEachTry! files process_file!

transform_file_content : Str, Str -> Str
transform_file_content = \current_url, html_content ->
    when List.findFirst nav_links (\{ url } -> url == current_url) is
        Ok current_nav_link -> Html.render (view current_nav_link html_content)
        Err _ -> crash "unable to find nav link for URL: $(current_url)"

view this post on Zulip Luke Boswell (Dec 17 2024 at 23:55):

Decided to add it, just in case.

view this post on Zulip jan kili (Dec 18 2024 at 14:43):

Could be nice for validating links? :shrug:


Last updated: Jul 05 2025 at 12:14 UTC