Stream: beginners

Topic: Bundling a package?


view this post on Zulip Matthew Griffith (Mar 05 2023 at 13:11):

Sorry if this is documented somewhere, I looked but couldn't find anything :sweat_smile:

I want to convert my tiny tui code into a package, bundle it, and allow people to use it via the url package thing. It depends on the basics_cli platform.

My best guess was to create a tui.roc file in the dir I'm working in and put this in it

package "tui"
    exposes [
        Term,
        Term.Unicode
    ]
    packages {  pf: "https://github.com/roc-lang/basic-cli/releases/download/0.2.0/8tCohJeXMBUnjo_zdMq0jSaqdYoCWJkWazBd4wa8cQU.tar.br" }

And then maybe run roc build tui.roc? Doesn't seem quite right, and that command also hangs.

Is there a script or process that I could check out on how to prepare the necessary .tar.br?

Bonus points, I would also love to generate docs for it :dancer:

view this post on Zulip Matthew Griffith (Mar 05 2023 at 13:45):

Ahhh, just found roc build --bundle=.tar.br!

view this post on Zulip Matthew Griffith (Mar 05 2023 at 13:50):

So, I think the issue is just that roc build tui.roc hangs.

Running with the --bundle produces this error

image.png

Maybe I need to create a directory or something? :thinking:

view this post on Zulip Richard Feldman (Mar 05 2023 at 14:51):

definitely seems like a compiler bug! is there a link to the code I can use to reproduce?

view this post on Zulip Matthew Griffith (Mar 05 2023 at 15:25):

Yes! Just made it public here: https://github.com/mdgriffith/roc-tui

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 15:51):

Does term depend on basic_cli?

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 15:51):

If so, i think that is the issue

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 15:51):

I don't think a package can depend on a platform

view this post on Zulip Matthew Griffith (Mar 05 2023 at 16:46):

Ah, interesting, ok

view this post on Zulip Matthew Griffith (Mar 05 2023 at 16:47):

Is that a design constraint or something that hasn't been implemented yet?

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 16:49):

Design constraint

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 16:49):

I don't think there is any plan to change that, but I could have missed something.

view this post on Zulip Matthew Griffith (Mar 05 2023 at 16:55):

Ok, good to know!

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 16:55):

Packages can't directly depend on platforms. They need to depend on a shared type or use other abstractions to convert to the platform types and effects.

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 16:55):

This keeps effects out of the packages.

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 16:56):

Hmm....That said, given effects are changing and becoming pure tag unions, I guess that would enable packages to use them directly...hmmm

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 16:56):

so yeah, things may change some.

view this post on Zulip Matthew Griffith (Mar 05 2023 at 16:57):

Awesome :sunglasses: For now I can make it pure and have them pass in the Stdout stuff!

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 16:59):

#ideas > effects in packages I think this discussed it some and fancier abstractions.

view this post on Zulip Richard Feldman (Mar 05 2023 at 19:24):

yeah it should be possible in the future but it's not yet :big_smile:

view this post on Zulip Richard Feldman (Mar 05 2023 at 19:24):

(packages depending on platforms I mean)

view this post on Zulip Richard Feldman (Mar 05 2023 at 19:25):

once https://github.com/roc-lang/roc/pull/5093 lands we might be able to start converting platforms over to that representation though!

view this post on Zulip Brendan Hansknecht (Mar 05 2023 at 19:35):

Oh, that's getting close. So exciting. Hopefully the rebasing for updating the glue stuff I have worked on isn't too painful.

view this post on Zulip Folkert de Vries (Mar 05 2023 at 19:55):

it should not be too bad I think. mostly it just needs the glue gen for function types


Last updated: Jul 06 2025 at 12:14 UTC