7

What does the bang (or exclamation mark) operator do in elm? I saw an application with an init like this:

init = emptyModel ! []

I've tried looking in the elm docs, but either there is no info or I couldn't find it:)

swelet
  • 8,192
  • 5
  • 33
  • 45

1 Answers1

14

The definition of the ! operator is here.

It takes a model, a list of commands and returns a tuple (pair) with a model and a single command which is the batch of all the commands

swelet
  • 8,192
  • 5
  • 33
  • 45
marcosh
  • 8,780
  • 5
  • 44
  • 74
  • 1
    Note that the `!` operator has been removed in Elm 0.19. See below: https://github.com/elm/compiler/blob/master/upgrade-docs/0.19.md#functions-removed – bowsersenior Dec 04 '18 at 20:13