Fable: Option value issue

Created on 24 Oct 2017  路  3Comments  路  Source: fable-compiler/Fable

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.

Most helpful comment

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

All 3 comments

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!

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomcl picture tomcl  路  4Comments

AngelMunoz picture AngelMunoz  路  4Comments

forki picture forki  路  3Comments

nozzlegear picture nozzlegear  路  3Comments

funlambda picture funlambda  路  4Comments