Why start another post?
The solution is to use Element.map
as said in the other post.
What do you mean exactly? Your exposed types from the other module can be opaque if you want them to stay “private”.
Maybe your issue is with this:
It does not feel right to want to use a Main
element in another module. Most likely you want it the other way: wrap the other element in your Main
using Element.map
.
Also do you really need another element with its own msg
type?
Maybe you could use the same pattern as the one for example used in Input.text
that takes a String -> msg
instead of requiring to use Element.map
(which is an heavy solution that should be used only when really necessary, for example for full SPA “pages”).
Look for example at An Approach to Nested Reusable View Functions in Elm | by Mickey Vashchinsky | Medium for a more detailed description.