>
> Elm doesn't have "no side effects", it has managed side effects. But if 
> there's no Task or Cmd or Sub in the type, you can be sure that the 
> function is side-effect free. This way, when there's problems with 
> side-effects, it's easy to track down which functions are causing them, 
> since you know pure ones will never be the problem.
>

To be totally clear on this, even if the function returns a Task or Cmd or 
Sub, the function is still side-effect 
<https://en.wikipedia.org/wiki/Side_effect_(computer_science)> free! It's 
just returning a value. You really can't write an Elm function that has 
side effects (without involving the Debug or Native modules), and that 
includes functions that return Task, Cmd, or Sub.

As it happens, the purpose of the values Cmd, Task, and Sub is to describe 
various effects that we'd like Elm's runtime to carry out eventually, but 
they are still just values nonetheless. Instantiating them is precisely as 
side-effectful as instantiating a String. ;)

-- 
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.

Reply via email to