fable-compiler / fable-arch

Framework for building applications based on the elm architecture.
https://fable-compiler.github.io/fable-arch/
Apache License 2.0
60 stars 14 forks source link

The `start` function returns another function, thus causing a compiler warning #53

Closed fsoikin closed 7 years ago

fsoikin commented 7 years ago
let app = createApp initModel view update renderer
start app   // warning here

The last line produces a compiler warning saying "This is a function value, you're probably missing an argument". This is because the start function returns not unit, but another function of type AppMessage<_,_> -> unit. This is apparently not an idle mistake, but is used in DevTools, as pointed out by @mastoj.

The proposed fix is to have two flavors of start - one returning the message intake function, and one returning unit:

// use this for devTools and other similar clever things
let startAndExposeMessageSink ... =
    // the contents of today's `start` goes here

// use this for normal apps written by mere mortals
let start ... = 
    startAndExposeMessageSink ... |> ignore
MangelMaxime commented 7 years ago

@fsoikin Your changes should be available in fable-arch 0.10.0

fsoikin commented 7 years ago

Thank you.