Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler hangs with roc test #7333

Open
lukewilliamboswell opened this issue Dec 11, 2024 · 0 comments
Open

Compiler hangs with roc test #7333

lukewilliamboswell opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@lukewilliamboswell
Copy link
Collaborator

lukewilliamboswell commented Dec 11, 2024

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]
@lukewilliamboswell lukewilliamboswell added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant