roc-parser icon indicating copy to clipboard operation
roc-parser copied to clipboard

Apply and keep are the same function

Open thenikso opened this issue 1 year ago • 1 comments

Hey, checking out the code of this excellent parser. really enjoying using it!

I just noticed that apply and keep are the same function but implemented with different syntax.

I personally prefer the keep naming and the apply body :D

thenikso avatar Dec 03 '24 17:12 thenikso

on a somewhat unrelated note, I was checking that apply code when trying to use the record builder syntax which works! In the "parseGame" function in the main example one could write:

    game =
        { map2 <-
            id: const (\id -> id) |> skip (string "Game ") |> keep digits |> skip (string ": "),
            requirements,
        }

thenikso avatar Dec 03 '24 17:12 thenikso