roc icon indicating copy to clipboard operation
roc copied to clipboard

does std lib support multi-line List definitions?

Open lukewilliamboswell opened this issue 3 years ago • 1 comments

I get the following error when trying to compile the below code. I assume this is because you cannot define a list that extends over multiple lines.

── UNFINISHED LIST ────────────────────────────────────── multi-line-lists.roc ─

I cannot find the end of this list:

17│  expect List.len [
                      ^

You could change it to something like [1, 2, 3] or even just [].
Anything where there is an open and a close square bracket, and where
the elements of the list are separated by commas.

Note: I may be confused by indentation% 
app "aoc-2021-day-3"
    packages { pf: "cli-platform/main.roc" }
    imports [
        pf.Program.{ Program },
        pf.Stdout,
        pf.Task.{ Task },
        pf.File,
        pf.Path.{ Path },
    ]
    provides [main] to pf

main : Program
main =
    Stdout.line "Something helpful"
    |> Program.quick

expect List.len [
[0,0,1,0,0],
[1,1,1,1,0],
[1,0,1,1,0],
[1,0,1,1,1],
[1,0,1,0,1],
[0,1,1,1,1],
[0,0,1,1,1],
[1,1,1,0,0],
[1,0,0,0,0],
[1,1,0,0,1],
[0,0,0,1,0],
[0,1,0,1,0]
] == 12

lukewilliamboswell avatar Oct 07 '22 03:10 lukewilliamboswell

Yes, but this must be a parse error

ayazhafiz avatar Oct 08 '22 23:10 ayazhafiz

Resolved. Indenting fixes this issue.

lukewilliamboswell avatar Dec 13 '22 07:12 lukewilliamboswell