More specifically, they aren't about managing JS related side effects (you can't actually do arbitrary JS related things using effect managers - only ports), but basically allow you to maintain a separate state and run Tasks to alter it in response to Cmds and Subs sent from the main elm app (and send things back to components in the main app whenever you like given Cmds and Subs). I'd suggest looking at code to work them out, for example the Websockets package. If you try writing your own, the compiler will help make sure you fill in the relevant "special" functions you need to declare to make it work (eg cmdMap, subMap, onEffects, onSelfMsg). If you can wait however, I'm sure the docs will explain it all much better when they arrive :)
On Tuesday, 31 May 2016 01:00:49 UTC+1, Vitor Capela wrote: > > Witold, > > I believe the docs will eventually be in > http://guide.elm-lang.org/effect_managers/. As far as I understand them, > they allow a library author to describe how side-effects happen, letting > the runtime bridge your purely functional code and the messy world around > it. Some descriptions of the API lie here: > http://package.elm-lang.org/packages/elm-lang/core/4.0.1/Platform > > Best, > > Vitor. > Em seg, 30 de mai de 2016 às 19:24, Witold Szczerba <[email protected] > <javascript:>> escreveu: > >> Hi, >> I am looking at: >> >> https://github.com/evancz/elm-architecture-tutorial/blob/master/examples/6-clock.elm >> >> … and trying to figure out what's going on there. The official guide does >> not cover this, I guess it's because it's a work in progress for 0.17. >> >> So, there is: >> >> subscriptions : Model -> Sub Msg >> subscriptions model = >> Time.every second Tick >> >> and the subscription is "picked" by >> Html.program's >> { ..., subscriptions: subscriptions ... } >> >> That part seems easy: "someone" (aka the Html Framework) just fires the >> thing and the timer begins to tick. So far so good, but I was wondering >> what Time.every is… The Time.elm starts like this: >> >> effect module Time where { subscription = MySub } exposing […] >> >> What does "effect module" mean? I tried to find this in >> http://elm-lang.org/docs (Syntax, Package Design), but it's not there. >> Is it something so new it's just not there yet or I can't find it? What >> does it mean? Is it something very special, part of Elm's syntax, or is it >> just an instance of some template/generic kind of module? >> >> Thanks, >> Witold Szczerba >> >> -- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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.
