This type is very special. The definition in Elm is solely a placeholder,
the actual implementation is in native code. You should not think further
about this trickery, assuming you want to program Elm, not
native-JS-in-the-runtime-of-Elm.

2016-09-21 11:30 GMT+02:00 'Rupert Smith' via Elm Discuss <
elm-discuss@googlegroups.com>:

> On Tuesday, September 20, 2016 at 4:25:42 PM UTC+1, Rupert Smith wrote:
>>
>> type Cmd msg = Cmd
>>
>
> I am still a bit perplexed by this. It is a parameterized type, but the
> parameter is thrown away and not used. I can only create one of them, since
> their is only one constructor.
>
> Given that, why do I have to use Cmd.none - if the only isntance of Cmd
> that can be constructed is Cmd, why not simply use Cmd instead of Cmd.none?
>
> Does this exist purely to make the commands created by the update function
> have a particular type, in order to constrain where and how that update
> function can be used?
>
> If the constructor takes no args, then Cmd must be encapsulating no
> context - I kind of thought the commands would be constructed with some
> context that tells the program what the command is, or how to execute it.
> That is a constructor like this:
>
> type Cmd msg = Cmd msg
>
> --
> 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 elm-discuss+unsubscr...@googlegroups.com.
> 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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to