Skip to content

Compiler hangs with roc test #7333

Open
@lukewilliamboswell

Description

@lukewilliamboswell
16:27:12 ~/Documents/GitHub/aoc main $ roc check test.roc
0 errors and 0 warnings found in 15 ms                                            
16:27:14 ~/Documents/GitHub/aoc main $ roc test test.roc
^C
module []

Mapper a : [ Start a, Middle a a a, End a ] -> a

mapAdjacent : List a, Mapper a -> List a
mapAdjacent = \values, fn ->
    when values is
        [] -> []
        [start, .. as rest] ->
            help : List a, a, List a -> List a
            help = \inner, left, acc ->
                when values is
                    [] -> acc
                    [end] -> help [] end (List.append acc (fn (End end)))
                    [middle, right, ..] -> help (List.dropFirst inner 1) middle (List.append acc (fn (Middle left middle right)))

            help rest start [fn (Start start)]

expect
    a = mapAdjacent [1] \_ -> 42
    a == [42]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions