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

Public values are allowed to have private types #1611

Open
exists-forall opened this issue Jul 7, 2017 · 2 comments
Open

Public values are allowed to have private types #1611

exists-forall opened this issue Jul 7, 2017 · 2 comments

Comments

@exists-forall
Copy link

exists-forall commented Jul 7, 2017

Elm modules are currently permitted to expose values whose type signatures mention types that the module does not expose, making the types of these public values "unmentionable" by code in any other modules. For example:

module ModuleA exposing (public)

type Private = Private

public : Private
public = Private
module ModuleB exposing (..)

import ModuleA

-- Can't give `foo` a type signature because `ModuleA.Private` is not exposed
foo = ModuleA.public

Making this at least a warning would prevent two possible classes of mistakes. First of all, it would prevent the above situation of a module author forgetting to expose a type that's essential to using its public values with explicit type annotations. Second of all, it would prevent module authors from thinking they've kept a type entirely private, when in fact it's partially exposed through a public type signature.

@process-bot
Copy link

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@jfmengels
Copy link
Contributor

For a example where this problem occurred: cuducos/[email protected] introduced a function which took a type as an argument, that was not being exposed in the package.

Thankfully, cuducos/[email protected] fixed the problem by exposing the module.

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

3 participants