Skip to content

On reload "Evaluating F# snipped failed" #114

@brodyberg

Description

@brodyberg

When I save index.md I get this in the cmd.exe output which breaks presentation refresh:

Evaluating F# snippet failed:


input.fsx(4,5): error FS0039: The value or constructor 'div' is not defined

The snippet evaluated:
// VIEW

let view model dispatch =
    div []
        [ button [ OnClick (fun _ -> dispatch Decrement) ] [ str "-" ]
          div [] [ str (model.ToString()) ]
          button [ OnClick (fun _ -> dispatch Increment) ] [ str "+" ] ]

Evaluating F# snippet failed:


input.fsx(3,1): error FS0039: The namespace or module 'Program' is not defined

The snippet evaluated:
// wiring things up

Program.mkSimple init update view
|> Program.withConsoleTrace
|> Program.withReact "elmish-app"
|> Program.run

Evaluating F# snippet failed:


input.fsx(4,16): error FS0039: The namespace or module 'Counter' is not defined

The snippet evaluated:
// MODEL

type Model = {
    Counters : Counter.Model list
}

type Msg =
| Insert
| Remove
| Modify of int * Counter.Msg

let init() : Model =
    { Counters = [] }

Evaluating F# snippet failed:


input.fsx(4,43): error FS0039: The value or constructor 'Modify' is not defined

The snippet evaluated:
// VIEW

let view model dispatch =
    let counterDispatch i msg = dispatch (Modify (i, msg))

    let counters =
        model.Counters
        |> List.mapi (fun i c -> Counter.view c (counterDispatch i))

    div [] [
        yield button [ OnClick (fun _ -> dispatch Remove) ] [  str "Remove" ]
        yield button [ OnClick (fun _ -> dispatch Insert) ] [ str "Add" ]
        yield! counters ]

Evaluating F# snippet failed:


input.fsx(5,7): warning FS0049: Uppercase variable identifiers should not generally be used in patterns, and may indicate a misspelt pattern name.


input.fsx(6,11): error FS0039: The record label 'Counters' is not defined

The snippet evaluated:
// UPDATE

let update (msg:Msg) (model:Model) =
    match msg with
    | Insert ->
        { Counters = Counter.init() :: model.Counters }
    | Remove ->
        { Counters =
            match model.Counters with
            | [] -> []
            | x :: rest -> rest }
    | Modify (id, counterMsg) ->
        { Counters =
            model.Counters
            |> List.mapi (fun i counterModel ->
                if i = id then
                    Counter.update counterMsg counterModel
                else
                    counterModel) }

And the presentation fails to update. So in my case I still see the example presentation previously written in index.md.

I also see this, which doesn't seem great but is written in informational text so I am not sure:

[I] 2017-10-17T16:52:06.4649090Z: websocket disconnected: SocketError ConnectionReset [Suave.Websocket.handShake]

FsReveal 1.3.1
FSharp.Core 4.0.0.1
FSharp.Compiler.Service 2.0.0.6
FAKE 4.28
FSharpVSPowerTools.Core 2.3
Suave 1.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions