Instead of the pipe here...
"Default color" |> ANSI.color({ fg: Default, bg: Default })
will we be able to dispatch on a Str?
"Default color".color({ fg: Default, bg: Default })
Thinking about this more... it's not a sensible question. Str isn't going to be a Custom Type.
I'm just looking at my ANSI examples... and debating if I refactor these to remove the |>
ANSI.color("Default color", { fg: Default, bg: Default })
Thinking about this more... I would probably refactor the API to have a ANSI.styled : Str -> ANSI or similar and then have methods hanging off that to style the string segment. Sounds like a job for future Luke. :smiley:
I think Str will be a custom type
And that you can call methods on a string
In the same way List would work
We need methods like List.map to work
Wait so "str".color(...) might work? I won't be able to write my own methods because Str is a builtin.
That would be my expectation yes
no, that would not work
In general, methods only get defined in the module of the custom type
right
because literally what the . is doing there is saying "go look up the type of the thing before the . and call a function by this name in its module"
If we didn't require that, then we'd have to do some expensive Rust style trait resolution
so "str".color(...) does exactly the same thing as Str.color("str", ...)
That said, assuming we support .(fn) you would be able to do:
from ANSI import color
"Default color".(color)({ fg: Default, bg: Default })
This is part of the reason I really want to support .(fn)(...)
Just without the python import syntax @Brendan Hansknecht :wink:
We need a Zulip LSP!!!
First we need Zulip to support Roc syntax highlighting
I wish we had a way to patch that in
Even if it was just TextMate grammar
Someone was working on it a while back
@Isaac Van Doren I think
I know that @Eli Dowling owns the Treesitter grammar, right?
Yep, but it's not Treesitter
Right, I know
And the TS grammar is woefully out of date now I think
https://docs.zulip.com/help/code-blocks#language-tagging
I think Eli is travelling for a month or so, he said he'd pickup the grammar one syntax madness settles a little
I did highlight-js support for roc but have not done textmate
Anthony Bullard said:
Just without the python import syntax Brendan Hansknecht :wink:
I have been writing too much python at work
You mean any at all?/s
Small Python Good, Big Python Bad
Indeed.
Last updated: Jun 16 2026 at 16:19 UTC