Stream: beginners

Topic: The stub for my new function causes a "panic" in Roc


view this post on Zulip Ashley Davis (Jun 27 2024 at 22:17):

I've started porting my next function from TypeScript to Roc.

I was trying to start with an empty stub that has roughly the right type signature:

interface Layout
    exposes [getNextRow]
    imports []

getNextRow = \items, galleryWidth, targetRowHeight, currentRowItems, width, removedItems, headings ->
    []

expect getNextRow [], 10, 20, [], 0, [], [] == []

Running roc test results in this error:

$ roc test
thread 'main' panicked at crates/reporting/src/error/parse.rs:700:14:
not yet implemented: unhandled parse error: Pattern(NotAPattern(@220), @220)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Does anyone know what this means?

view this post on Zulip Kiryl Dziamura (Jun 27 2024 at 22:32):

I’d assume that was caused by the commas in the line with expect. Roc has commas in parameters (function definition), but not in arguments (function call).

Try to remove them and probably wrap the whole expression after expect starting from getNextRow till the end of the line (but it might be unnecessary)

view this post on Zulip Ashley Davis (Jun 30 2024 at 21:06):

Oh yes that was it thank you!


Last updated: Jul 06 2025 at 12:14 UTC