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

Issue with spaced ? in pipeline #7567

Open
Anton-4 opened this issue Jan 31, 2025 · 0 comments
Open

Issue with spaced ? in pipeline #7567

Anton-4 opened this issue Jan 31, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Anton-4
Copy link
Collaborator

Anton-4 commented Jan 31, 2025

The code below should work:

app [main!] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br" }

import pf.Arg
import pf.Stdout

parse_arg = |arg|
    { after, before } = Str.split_first(arg, ".")?
    Ok (Str.to_dec(before)?, Str.to_dec(after)?)

main! : List Arg.Arg => Result {} [Exit I32 Str]
main! = |args|
    args
    |> List.map(Arg.display)
    |> List.map_try(parse_arg) ? |_| Exit 1 "Invalid arg"
    |> List.for_each! |(day, sub)| Stdout.line! "Solving problem forday ${Num.to_str day} sub ${Num.to_str sub}" ?? {}
    |> Ok

But for now it returns an error:

The map_try function expects 2 arguments, but it got only 1:

14│      |> List.map_try(parse_arg)
            ^^^^^^^^^^^^

Useful context: #7530

zulip discussion

@Anton-4 Anton-4 added the bug Something isn't working label Jan 31, 2025
@Anton-4 Anton-4 changed the title Issue with ? in pipeline Issue with spaced ? in pipeline Jan 31, 2025
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