f# - Does mkProgram expose more functionality than mkSimple? -
i trying understand difference between mksimple , mkprogram in fable-elmish, or elmish.wpf using. (can perhaps produce tag elmish.wpf please?)
i have found elmish.wpf incredibly effective, use in production, i'm @ stage i'm still learning lot every day. particular question gobbling of research time, appreciate help.
the comments in source looks this.
mksimple : simple program produces new state 'init' , 'update'.
mkprogram : typical program, new commands produced 'init' , 'update' along new state.
so commands for? have looked @ examples in several places, don't give of clue whether can same mksimple mkprogram, , that's need know.
does mkprogram expose functionality mksimple not, or can done whichever 1 use? mksimple simple demo use, , should using mkprogram real world applications grow? if can both, why difference?
mksimple learning purposes. helps ease new users framework not introducing ideas of cmd yet.
if @ source of mksimple, see doing hiding cmd idea (by using cmd.none) , calling mkprogram:
/// simple program produces new state `init` , `update`. let mksimple (init : 'arg -> 'model) (update : 'msg -> 'model -> 'model) (view : 'model -> dispatch<'msg> -> 'view) = { init = init >> fun state -> state,cmd.none update = fun msg -> update msg >> fun state -> state,cmd.none view = view setstate = fun model -> view model >> ignore subscribe = fun _ -> cmd.none onerror = onerror } its origins elm architecture, has since renamed simple program beginnerprogram.
if want want write program complexity, use mkprogram. if merely tinkering or demonstrating basics, may able use mksimple.
Comments
Post a Comment