Stream: contributing

Topic: Migrating roc-isodate


view this post on Zulip Aurélien Geron (Jul 03 2026 at 12:58):

I'm in a migration mood, looking at migrating @Ian McLerran's roc-isodate's library. Hopefully, it shouldn't take too long, but I do have one question: how should I migrate parametrized modules? For example:

# Now.roc
module { now!, now_to_nanos } -> [date_time!, date!, time!]

and:

import dt.Now {
     now!: Utc.now!,
     now_to_nanos: Utc.to_nanos_since_epoch,
}

I guess the new approach is simply to define an opaque type like this:

Now :: { now! : ({} => Now), now_to_nanos: (Now -> U64) }.{ ... }

which can then be used like this:

import dt.Now

now = Now.create({now!: Utc.now!, now_to_nanos: Utc.to_nanos_since_epoch))
datetime = now.date_time!({})

Does this look good to you?

view this post on Zulip Anton (Jul 03 2026 at 13:10):

Seems logical to me

view this post on Zulip Aurélien Geron (Jul 03 2026 at 13:13):

Thanks @Anton

view this post on Zulip Aurélien Geron (Jul 03 2026 at 13:17):

Mmh, I just noticed that roc-isodate depends on two libraries:

They are only used for a few functions, so I think I'll just reimplement them locally rather than port two more libraries.

From rutils:

The roc-tinyparse library is only used to implement parse_frac_fmt so I think I'll use roc-parser instead since I just migrated it.


Last updated: Jul 23 2026 at 13:15 UTC