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

Option value issue #1203

Closed
ncave opened this issue Oct 24, 2017 · 3 comments
Closed

Option value issue #1203

ncave opened this issue Oct 24, 2017 · 3 comments

Comments

@ncave
Copy link
Collaborator

ncave commented Oct 24, 2017

It's probably a corner case, but it's breaking the repl:

module App

let test xss =
    let f xss = xss |> List.choose (function Some a -> Some a | _ -> None)
    xss |> f |> List.collect (fun xs -> [ for s in xs do yield s ])

[<EntryPoint>]
let main argv =
    let res = test [ Some [ "a" ] ]
    printfn "res: %A" res
    0

runtime error:

Seq.js:470
  }, xs[Symbol.iterator]()));
                        ^

TypeError: xs[Symbol.iterator] is not a function

basically, the issue is xs does not have the correct value, the correct value is in the xs.value property.

@alfonsogarciacaro
Copy link
Member

Damn, the change with Options is affecting more places than expected, as happened with the uncurrying optimization. Let's see if we don't have many more surprises... I hope I'm not introducing too many exceptional behaviours in Fable 🙏

Thanks for reporting and for the code to reproduce the issue as always @ncave!

@ncave
Copy link
Collaborator Author

ncave commented Oct 24, 2017

@alfonsogarciacaro It's making the world a better place (a more exceptional one). Thanks!

@ncave
Copy link
Collaborator Author

ncave commented Oct 24, 2017

@alfonsogarciacaro Hooray, that actually worked, the repl is operational again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants