Hi. New here, aspiring to get proficent with Roc.
After wrestling with packaging in nix the roc-treesitter-grammar, I've managed to get emacs + roc-ts-mode working. So far it seems to be ok but...
how can I browse the definitions (types and functions) available in the chosen platform? how about imports?
e.g.:
import platform.Arg exposing [Arg]
ok, what now?
how can I see what can I do with Arg? what's inside it?
I hoped there would be something like
:browse <type/module>
in the repl to get a listing of type signatures, but it's not there... so, where can I get something like that?
What platform are you looking at?
For example, here's the docs for basic-cli -- https://roc-lang.github.io/basic-cli/0.19.0/
Yeah, documentation is one thing, but let's say I'm working on something that's not documented. I could get around just fine with type signatures, but most importantly, being able to query roughly "What's this and what functions can I use with this?"
Years ago I wrote some Haskell, when it was deemed a good lang to learn "to be a better programmer". Parted ways with it long long ago, but I remember being able to browse modules definitions, searching by type signature, and that was really handy, because I could explore what I could use right where I was working instead of having to fire a web browser and shuffling through documentation.
Let's say there's a type Arg defined, ok, what's it's definition? what functions can I use to work with an Arg? If there's documentation, that'd be the next thing to look at IF the typesignature isn't obvious on it's own.
For example, if I import the basic-cli platform, and do something like:
:browse Path
I'd get a list like this:
Path
DirEntry
IOErr
write! : val, Path, fmt => Result {} [FileWriteErr Path IOErr]
write_bytes! : List U8, Path => Result {} [FileWriteErr Path IOErr]
write_utf8! : Str, Path => Result {} [FileWriteErr Path IOErr]
from_str : Str -> Path
from_bytes : List U8 -> Path
display : Path -> Str
is_dir! : Path => Result Bool [PathErr IOErr]
is_file! : Path => Result Bool [PathErr IOErr]
is_sym_link! : Path => Result Bool [PathErr IOErr]
type! : Path => Result [IsFile, IsDir, IsSymLink] [PathErr IOErr]
with_extension : Path, Str -> Path
delete! : Path => Result {} [FileWriteErr Path IOErr]
read_utf8! : Path => Result Str [ FileReadErr Path IOErr, FileReadUtf8Err Path]
read_bytes! : Path => Result (List U8) [FileReadErr Path IOErr]
list_dir! : Path => Result (List Path) [DirErr IOErr]
delete_empty! : Path => Result {} [DirErr IOErr]
delete_all! : Path => Result {} [DirErr IOErr]
create_dir! : Path => Result {} [DirErr IOErr]
create_all! : Path => Result {} [DirErr IOErr]
hard_link! : Path => Result {} [LinkErr IOErr]
Love the idea. :smiley:
I think Roc will be well suited to building this kind of developer tooling. The REPL could probably do something like this.
Hi @grp,
what functions can I use to work with an Arg?
The most convenient way is probably to view the autocomplete when you enter Arg.
in the IDE.
If you're new to Roc though I would probably recommend searching through the examples folder, e.g.:
https://github.com/search?q=repo%3Aroc-lang%2Fbasic-cli%20%22Arg.%22%20path%3Aexamples%2F&type=code
Last updated: Aug 17 2025 at 12:14 UTC