Fable: REPL don't know keyValueList function

Created on 18 Sep 2017  路  10Comments  路  Source: fable-compiler/Fable

It's seems like the REPL only know the old way of using KeyValueList:

error FSHARP: The value or constructor 'keyValueList' is not defined. Maybe you want one of the following:
KeyValueListAttribute

Repro:

open Fable.Core
open Fable.Core.JsInterop
open System

type IMyOptions =
    interface end

type MyOptions =
    | Flag1
    | Name of string
    | [<CompiledName("Foo")>] QTY of int
    interface IMyOptions

type MyOptions2 =
    | Bar of int*int
    interface IMyOptions

let ``KeyValueList works at compile time``() =
    let opts =
        [ Name "Fable" :> IMyOptions
        ; QTY 5 :> IMyOptions
        ; Flag1 :> IMyOptions
        ; Bar(2,3) :> IMyOptions ]
        |> keyValueList CaseRules.LowerFirst
    opts?name |> unbox |> equal "Fable"
    opts?foo |> unbox |> equal 5
    opts?flag1 |> unbox |> equal true
    opts?bar?(1) |> unbox |> equal 3
    let opts2 = keyValueList CaseRules.None [ Name "Fable"]
    opts2?Name |> unbox |> equal "Fable"

Most helpful comment

@alfonsogarciacaro I'm not sure I would call that interesting, but yes, there are a whole bunch of open and closed issues related to the System.ValueTuple in the MS F# repo. Hopefully it will go away once we switch to netstandard 2.0.

All 10 comments

Yeah, this is because I didn't manage to generate the metadata for the new Fable.Core version :/ Pinging @ncave

Yes, I was thinking about something like that but I couldn't build the REPL target because I can't build the FCS project on my computer. I will need to take a look at that later as I have some idea for the REPL.

@alfonsogarciacaro @MangelMaxime Unfortunately it's the status quo until we get support for netcore binaries in the REPL.

But of course! I didn't realize until you let me notice @ncave 馃槈 We can just compile Fable.Core with net45 target 馃憤 The REPL is updated and supports latest Fable.Core APIs now :tada:

:heart:

@alfonsogarciacaro Awesome!

@alfonsogarciacaro I can't open System in the REPL now.

stdin.fsx(1,11): (1,12) error FSHARP: The type 'ValueType' is required here and is unavailable. You must add a reference to assembly 'System.Runtime'.

@MangelMaxime Obviously you want to have everything ;) It should be fixed now :) Thanks for checking, please tell me if you find any other issue.

@ncave This is interesting, I added a reference to System.ValueTuple.dll to avoid the message Cannot find type System.ValueTuple in the console but apparently this conflicted with the System namespace. It didn't solve by adding a reference to System.Runtime.dll so I just removed ValueTuple again.

@alfonsogarciacaro I always want everything :) Seems good to me :clap:

@alfonsogarciacaro I'm not sure I would call that interesting, but yes, there are a whole bunch of open and closed issues related to the System.ValueTuple in the MS F# repo. Hopefully it will go away once we switch to netstandard 2.0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

forki picture forki  路  3Comments

krauthaufen picture krauthaufen  路  3Comments

et1975 picture et1975  路  3Comments

et1975 picture et1975  路  3Comments

jwosty picture jwosty  路  3Comments