On `none` patterns

Very good point, thank you for bring it up!
Yes, having batch function might actually be more generally helpful for this. As you pointed out,

  • It IS actually a building block for none function
  • Even without none, it allows us to do the equivalent by batch []
  • It essentially enables us to flatten Lists!!

I found the 3rd point very interesting, related to code modularity.
As we are already using Cmd.batch to do things like this:

fooCmd : Cmd Msg
fooCmd =
    Cmd.batch [ fooDoThis, fooDoThat ]

barCmd : Cmd Msg
barCmd =
    Cmd.batch [ barDo ]

rootCmd : Cmd Msg
rootCmd =
    Cmd.batch
        [ rootDoThis
        , rootDoThat
        , fooCmd
        , barCmd
        ]

(Of course we throw in Cmd.map when some of them are within their own Msg scope)

If inlined, it looks like:

rootCmd =
    Cmd.batch
        [ rootDoThis
        , rootDoThat
        , Cmd.batch
            [ fooDoThis
            , fooDoThat
            ]
        , Cmd.batch
            [ barDo
            ]
        ]

This flatten-ing is, although verbose and manual, quite powerful I think since it cannot be done with ordinary List.flatten.