Hey folks -
I have this idea of creating a simple cli application. It is supposed to be a pair of elm-book (a documentation/styleguide library for elm apps). I was wondering if I should do it with Haskell, Rust... pretty much as a learning exercise for me. tbh I'm just waiting until I can use Roc for things and I wondered if I couldn't already do so?
Maybe a pairing session between me (experienced elm developer and complete Roc beginner) with someone who knows Roc would be an entertaining thing even there are a lot of "Roc is still WIP" announcements around it. What do you think? And would someone be interested in pairing up with me?
The scope is quite simple: read text files, do pattern matching on them, read more text files, write some text files. done.
I recommend Roc for this, and I'd love to pair with you on it! Are you available for a synchronous video meeting some weekday this week between and ?
If not, I'm also semi-available between and
Anyone else who wants to join is welcome! :smiley: (to learn about v0.0 Roc app development and/or contribute to the app)
@JanCVanB awesome! Would you be available some time next week? I think it would be better if I actually wrote down the specs and prepare my local environment before we dive into it so our session is more productive! :) also - if you could give me a direction on the ideal local setup that would help me a lot! (I'm on macOS)
Yes! When in those time-of-day windows next week works for you?
any time between would be ideal!
Specs & setup this week sounds good. I recommend following the installation guide and getting app #1 in here running. (Nothing special about that app, just that it's a Roc app outside the Roc repo, like yours will be)
awesome! I'll set things up and confirm things with you along this week! thanks so much! it will be fun :)
Let's plan for - for our first session!
Any other Roc learners want to join to start an app of their own?
Any other Roc veterans want to join to supplement my knowledge?
(if you don't mind, I'll also talk about it on a few Elm chats to see if anyone wants to watch it! I'm sure there will be a few)
(to that end, I'm happy to record it and post it on YouTube afterward, if you want)
(but maybe advertising that fact is unnecessary, since we'd prefer synchronous company! :laughing: )
that would be great!
Hey guys, I'd love to see this on YouTube if you have the time to set that up ;)
Remember that recording rule though, make that font BIG :grinning_face_with_smiling_eyes:
@JanCVanB
Sounds like a fun project. I'm always willing to give advice and help with roc stuff, especially platforms. I tend to mess with them pretty often.
Keen! See you all then :big_smile:
Anyone who's interested in an introduction to Roc app development, join us at ! :smiley:
@Georges Boris @Ralf Engbers @doubledup @Brendan Hansknecht
I'll post a video chat link in here before then.
If you can't join live, we'll have some kind of recording of it on YouTube later this week.
Here's the link for the party at , feel free to share it around! https://meet.jit.si/AppDevelopmentWithRoc
@Georges Boris @Ralf Engbers @doubledup @Brendan Hansknecht @Brian Carroll @Ghislain @Richard Feldman
hey folks! I'm trying to compile Roc from source for this session (I've previously done it using nix)
but just using cargo compile --release is giving me unsuitable llvm errors
what version should I be trying to install using llvmenv? (running macOS - not M1)
LLVM 13 is needed
@Georges Boris if that fails, I can send you my macOS x86 build (rebuilding right now)
So this time you are trying to build roc from source while manually installing packages instead of using the nix development environment? why?
We also have a macos x86_64 nightly release
@JanCVanB worked on a few features last night that are not yet in the nightly build! So I'm building from source.
and I'm not using nix to do it just because I haven't found the docs about it on the repo anymore :sweat_smile:
You will also need to insall zig 0.9.1 if you don't want to use nix
Thanks, everyone, for attending! That was fun, let's do it again sometime :smiley:
I think that counted as a "meetup"...
It sure was! Hopefully it will get more people excited about trying out Roc right now instead of waiting :)
Here's where we got, for anyone who missed it:
app "elm_book_mimic"
packages { pf: "roc/examples/interactive/cli-platform/main.roc" }
imports [pf.Stdout, pf.Stderr, pf.Task, pf.File, pf.Path]
provides [main] to pf
main : Task.Task {} [] [Write [File, Stdout, Stderr], Read [File], Env]
main =
templateFile = Path.fromStr "template.txt"
contentFile = Path.fromStr "content.txt"
renderFile = Path.fromStr "render.txt"
task =
template <- File.readUtf8 templateFile |> Task.await
content <- File.readUtf8 contentFile |> Task.await
{ before, after } =
Str.splitFirst template "content goes here!\n"
|> Result.withDefault { before: template, after: "" }
render = "\(before)\(content)\(after)"
File.writeUtf8 renderFile render
Task.attempt task \result ->
when result is
Err (FileWriteErr _ PermissionDenied) -> Stderr.line "Err: PermissionDenied"
Err (FileWriteErr _ Unsupported) -> Stderr.line "Err: Unsupported"
Err (FileWriteErr _ (Unrecognized _ other)) -> Stderr.line "Err: \(other)"
Err (FileReadErr _ _) -> Stderr.line "Error reading file"
Err _ -> Stderr.line "Uh oh, there was an error!"
Ok _ -> Stdout.line "Successfully rendered!"
jan@mackey app_development_with_roc % cat template.txt
text text text
content goes here!
other text other text
jan@mackey app_development_with_roc % cat content.txt
I AM THE CONTENT
jan@mackey app_development_with_roc % cat render.txt
text text text
I AM THE CONTENT
other text other text
jan@mackey app_development_with_roc %
@JanCVanB are you going to publish it on youtube? I'm up for sharing the video in a few places when it have it ready
Will publish this week! Might try to do some audio cleanup...
I couldn't help but refactor that app a bit, here's where I've gotten so far, to make it more Roc-y in my eyes:
app "elm_book_mimic"
packages { pf: "roc/examples/interactive/cli-platform/main.roc" }
imports [pf.Stdout, pf.Stderr, pf.Task, pf.File, pf.Path]
provides [main] to pf
main = Task.attempt steps handleResult
steps =
template <- read "template.txt" |> Task.await
content <- read "content.txt" |> Task.await
{ before, after } = split template "content goes here!\n"
write "render.txt" "\(before)\(content)\(after)"
read = \path -> path |> Path.fromStr |> File.readUtf8
write = \path, text -> path |> Path.fromStr |> File.writeUtf8 text
split = \text, splitPoint ->
text
|> Str.splitFirst splitPoint
|> Result.withDefault { before: text, after: "" }
handleResult = \result ->
when result is
Err (FileWriteErr _ PermissionDenied) -> Stderr.line "Err: PermissionDenied"
Err (FileWriteErr _ Unsupported) -> Stderr.line "Err: Unsupported"
Err (FileWriteErr _ (Unrecognized _ other)) -> Stderr.line "Err: \(other)"
Err (FileReadErr _ _) -> Stderr.line "Error reading file"
Err _ -> Stderr.line "Uh oh, there was an error!"
Ok _ -> Stdout.line "Successfully rendered!"
I truly do love the |>
operator... :heart_eyes:
A nice demonstration of backpassing as well :)
folks - is the platform we used for the session supposed to be available in the current nightly release for mac os? I've downloaded the last two builds and there is only "hello-world" in the examples folder:
https://github.com/roc-lang/roc/releases
No, the releases only contain the hello world platform - you need to clone the roc repo to get the other examples, one of which is what we used
However, perhaps now/soon we should bundle the example CLI platform with the releases!
Eventually it won't be necessary, when any published platform is available as a remote package via package manager
I actually think it's probably better for now to encourage people to clone the repo to get the CLI platform, since it's being actively updated; otherwise you'll probably get the one version you downloaded with whenever you happened to get Nightly, and won't have the convenient git pull
to update it
If they aren't building from source they may have to update their version of the compiler anyway to support newer versions of the platform.
Interesting
true!
got it! so - I know this is getting off-topic but just so we can finish the thread: when building from source via cargo build --release
where would I find the build result similar to what one would see on nightly builds?
the roc binary would be in the folder target/release/
If you move the roc binary somewhere else, you should also copy along the lib folder (also in target/release/)
Last updated: Jul 05 2025 at 12:14 UTC