Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The @docs on a type alias expose every other function #4

Open
ghivert opened this issue Dec 6, 2017 · 0 comments
Open

The @docs on a type alias expose every other function #4

ghivert opened this issue Dec 6, 2017 · 0 comments

Comments

@ghivert
Copy link

ghivert commented Dec 6, 2017

Hi,

In my code, I'm doing this:

## Elements Types

@docs Node

Which gets compiled to:


Elements Types

type alias Node

type alias Node msg =
    Html msg



type FlexItem msg
    = FlexItem (Node msg)


extractNodeInFlexItem : FlexItem msg -> Node msg
extractNodeInFlexItem (FlexItem item) =
    item



type GridItem msg
    = GridItem (Node msg)


extractNodeInGridItem : GridItem msg -> Node msg
extractNodeInGridItem (GridItem item) =
    item



type Option msg
    = Option (Html msg)


extractOption : Option msg -> Html msg
extractOption (Option option) =
    option



text : String -> Node msg
text =
    Html.text



none : Node msg
none =
    text ""



br : Node msg
br =
    Html.br [] []



program :
    { init : ( model, Cmd msg )
    , subscriptions : model -> Sub msg
    , update : msg -> model -> ( model, Cmd msg )
    , view : model -> Html msg
    }

The main type of BodyBuilder. It is an alias to Html, in order to keep
perfect backward compatibility.


That's weird because it shows every functions using it (I understand the design choice), but including the not exposed functions. To me, it adds useless informations to the user: i.e. in my example, as a user, I don't care about extractNodeInFlexItem, because it is an internal. It is the same in the FlexItem type: it is an opaque type, and the docs show the content. It is confusing because if I'm trying to use the inside type, I can't.

IMO, the docs should only generates the docs above the elm function by default, and allowing to include all exposed functions (or all functions) using it if needed, for internal docs for instance as an option.

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant