I think we are galaxies away from a world where this issue should be a
priority for work on the compiler or other Elm language tools. :-)

2016-09-08 15:31 GMT+02:00 'Thomas Henley' via Elm Discuss <
elm-discuss@googlegroups.com>:

> Browsing the source of the Html.App module in order to see the signature
> of Html.App.map and how it works I read the documentation
> to get a good understanding of the function, which can be seen below
>
> https://github.com/elm-lang/html/blob/1.1.0/src/Html/App.elm#L52
>
>
>> {-| This function is useful when nesting components with [the Elm
>> Architecture](https://github.com/evancz/elm-architecture-tutorial/). It
>> lets
>> you transform the messages produced by a subtree.
>>
>>
>> Say you have a node named `button` that produces `()` values when it is
>> clicked. To get your model updating properly, you will probably want to
>> tag
>> this `()` value like this:
>>
>>    type Msg = Click | ...
>>
>>    update msg model =
>>      case msg of
>>        Click ->
>>          ...
>>     view model =
>>      map (\_ -> Click) button
>>
>> So now all the events produced by `button` will be transformed to be of
>> type
>> `Msg` so they can be handled by your update function!
>> -}
>> map : (a -> msg) -> Html a -> Html msg
>> map =
>>   VirtualDom.map
>
>
> I then went and checked out the implementation of VirtualDom.map and
> noticed the comment being identical
> https://github.com/elm-lang/virtual-dom/blob/master/src/VirtualDom.elm#L79
>
> I couldn't help but think, keeping comments between packages in sync has
> to be a pointless task and a waste
> of time, even worse if one updates without the other we have two identical
> functions with different sets of
> documentation.
>
> I'm proposing we have a way of inheriting comments from another function,
> two (maybe possible) ways I could
> think off were
>
> *Alternative version of special doc comment*
>
>> {-> VirtualDom.map -}
>
>
> Instead of a pipe character, using an arrow pointing to the function which
> is being documented
>
> *Version similar to @docs keyword*
>
>> {-| @inherit VirtualDom.node -}
>
>
>
> I'm galaxies away from being experienced in compiler/language design so
> forgive me if this is sounds like
> a ridiculous idea.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to