By Side effects I meant commands, sorry still have not had any tea yet today
Zach ᐧ On Wed, Aug 17, 2016 at 7:34 AM, Zachary Kessin <[email protected]> wrote: > I think the format for exporting types must be someform of json encoding, > for everyone's sanity. And I think when you are in "Re play mode" side > effects should be ignored in favor of the existing events. > > Zach > ᐧ > > On Tue, Aug 16, 2016 at 7:35 PM, Kasey Speakman <[email protected]> > wrote: > >> I've started looking at this. The first hurdle is that updates return >> both a model update and a side effect. So you could not replay side effects >> as they may not be deterministic. (Replay produces Cmd which returns a >> different result message from first time. The time traveling debugger gets >> around this by disabling Cmd when replaying.) Not to mention running Cmds >> depends on some outside access (at least mocking it). >> >> There is a discussion of that here >> <https://groups.google.com/forum/#!topic/elm-discuss/yKRYkoiQmPs> and I >> made a gist of a possible way to implement side effect isolation here >> <https://gist.github.com/kspeakman/109475ecdd3068a022b59f7f73c9485a>. >> Look at the comment first to see what it looks like in use. >> >> The other hurdle is events are likely to be union types with data. All >> the JSON encoding/decoding I've see in Elm for union types are for the >> simple kind where the case has no other values (like an enum). So having a >> case with values will be a challenge. In JSON.NET, serialized F# union >> type `CaseName ("something", 1, 3.5)` would look like this: `{ "Case": >> "CaseName", "Fields": ["something", 1, 3.5] }`. Note: case values are >> tuples in F#. Javascript allows arrays to contain dissimilar types, so this >> works. >> >> But, making a custom encoder/decoder for every union case makes you want >> to rethink life choices. Indeed, it might be better to just use Redux-style >> messages where the type is a string so you can send the events out of a >> port for free. It's a shame to lose out on that nice union syntax, but man >> the pain. >> >> Even then, you will still feel the pain on decoding. Actually, decoding >> anything is painfully manual in Elm. However, there are no surprises that >> way. >> >> On Thursday, July 28, 2016 at 6:58:58 AM UTC-5, Zachary Kessin wrote: >>> >>> I know the idea of having an event stream that can be exported and >>> replayed has been kicked around a bit for a while. Has anyone ever done >>> anything with this? >>> >>> Ideally I would like to be able to generate a sequence of events with a >>> QuickCheck type tool (either in elm or erlang) >>> >>> Zach >>> >>> -- >>> Zach Kessin >>> SquareTarget <http://squaretarget.rocks?utm_source=email-sig> >>> Twitter: @zkessin <https://twitter.com/zkessin> >>> Skype: zachkessin >>> ᐧ >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Elm Discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Zach Kessin > SquareTarget <http://squaretarget.rocks?utm_source=email-sig> > Twitter: @zkessin <https://twitter.com/zkessin> > Skype: zachkessin > -- Zach Kessin SquareTarget <http://squaretarget.rocks?utm_source=email-sig> Twitter: @zkessin <https://twitter.com/zkessin> Skype: zachkessin -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
