@@ -3,6 +3,11 @@ namespace Fabulous
33open System
44open System.Diagnostics
55
6+ (* TODO Is either of these a program in the Elm sense? If so, where's the view in this one?
7+ Or are these rather abstractions of or pre-cursors to an Elm Program?
8+ AFAIU in the Elm architecture a "program" manages the application's (or component's) state, actions, and view rendering.
9+ Please help me as a MVU/Elm newbie understand these types. *)
10+ //TODO what's the 'arg?
611/// Configuration of the Fabulous application
712type Program < 'arg , 'model , 'msg > =
813 {
@@ -21,6 +26,7 @@ type Program<'arg, 'model, 'msg> =
2126 ExceptionHandler: exn -> bool
2227 }
2328
29+ //TODO how is this different to the above? What's a 'marker? what's the 'arg?
2430type Program < 'arg , 'model , 'msg , 'marker > =
2531 {
2632 State: Program < 'arg , 'model , 'msg >
@@ -66,31 +72,44 @@ module Program =
6672 Logger = ProgramDefaults.defaultLogger()
6773 ExceptionHandler = ProgramDefaults.defaultExceptionHandler }
6874
75+ //TODO when would I use this one? How does it compare to the other stateful* builders?
76+ //TODO what's expected for 'arg?
6977 /// Create a program using an MVU loop
7078 let stateful ( init : 'arg -> 'model ) ( update : 'msg -> 'model -> 'model ) =
7179 define ( fun arg -> init arg, Cmd.none) ( fun msg model -> update msg model, Cmd.none)
7280
81+ //TODO when would I use this one? How does it compare to the other stateful* builders?
82+ //TODO please explain the concept Cmd<'msg>
83+ //TODO what's expected for 'arg?
7384 /// Create a program using an MVU loop
7485 let statefulWithCmd ( init : 'arg -> 'model * Cmd < 'msg >) ( update : 'msg -> 'model -> 'model * Cmd < 'msg >) = define init update
7586
87+ //TODO when would I use this one? How does it compare to the other stateful* builders?
88+ //TODO please explain the concept CmdMsg vs. Cmd<'msg>
89+ //TODO what's expected for 'arg?
7690 /// <summary >
7791 /// Create a program using an MVU loop supporting CmdMsg.
7892 /// See also
7993 /// <seealso href =" https://elmprogramming.com/elm-architecture-conclusion.html " />
94+ /// ?
8095 /// </summary >
8196 let statefulWithCmdMsg ( init : 'arg -> 'model * 'cmdMsg list ) ( update : 'msg -> 'model -> 'model * 'cmdMsg list ) ( mapCmd : 'cmdMsg -> Cmd < 'msg >) =
8297 let mapCmds cmdMsgs = cmdMsgs |> List.map mapCmd |> Cmd.batch
8398 define ( fun arg -> let m , c = init arg in m, mapCmds c) ( fun msg model -> let m , c = update msg model in m, mapCmds c)
8499
100+ (* TODO Subscriptions will be started or stopped automatically to match.
101+ - I don't understand what that means. What (other?) Subscriptions - or - to match what?*)
85102 /// <summary >
86103 /// Subscribe to external source of events, overrides existing subscription.
87104 /// Return the subscriptions that should be active based on the current model.
88105 /// Subscriptions will be started or stopped automatically to match.
89106 /// See also
90107 /// <seealso href =" https://elmprogramming.com/subscriptions.html " />
108+ /// ?
91109 /// </summary >
92110 let withSubscription ( subscribe : 'model -> Sub < 'msg >) ( program : Program < 'arg , 'model , 'msg >) = { program with Subscribe = subscribe }
93111
112+ //TODO In what scenario would I want to use this?
94113 /// Map existing subscription to external source of events.
95114 let mapSubscription map ( program : Program < 'arg , 'model , 'msg >) =
96115 { program with
0 commit comments