The lower case msg
is called a type variable.
The upper case Msg
is called a concrete type - its something your application has defined.
So we might have:
view : Html msg
view = div [] []
and
type Msg = Click
view : Html Msg
view = div [ onClick Click ] []
The first one doesn’t produce any events, so its type variable is not bound to anything yet.
The second one produces events of your Msg
type, and its type variable is bound to that.
Also note that this compiles ok:
innerView : Html msg
innerView = div [] []
view : Html Msg
view = div [ onClick Click ] [ innerView ]
Here innerView
needs to have the type Html Msg
to be included in some HTML with that type. That’s ok because the free msg
variable can be bound to Msg
and the type checking passes.
Make sense?