Elm spa example header with shared button (on Click) attribute

The viewHeader function in my example does not have to be literally in the Main.elm module.
It can be in its own module, taking a msg argument:

module Main exposing (main)

import Header

type Msg
    = HeaderClicked
    | GotHomeMsg Home.Msg


view model =
            ...
            in
            { title = title
            , body = Header.view HeaderClicked :: List.map (Html.map toMsg) body
            }
module Header exposing (view)

view : msg -> Html msg
view onClick = 
    div []
    [ button
        [ onClick msg ]
        []
    ]

or if really needed could have its own Msg which would be mapped like the pages ones.

At the end, all messages are Main ones, for example:

type Msg
    = HeaderMsg Header.Msg
    | GotHomeMsg Home.Msg
    ...


view model =
            ...
            in
            { title = title
            , body = Html.map HeaderMsg viewHeader :: List.map (Html.map toMsg) body
            }

I would strongly prefer the first solution (the msg argument(s)) as long as one or two messages for the header are enough.

Lastly:

Try to structure by types, not by code size.
See The life of a file.