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

Changing opaque type to type alias results in MAJOR bump #1895

Open
gampleman opened this issue Feb 15, 2019 · 3 comments
Open

Changing opaque type to type alias results in MAJOR bump #1895

gampleman opened this issue Feb 15, 2019 · 3 comments

Comments

@gampleman
Copy link
Contributor

module Foo exposing (Foo)

type Foo =
     Foo Int

Gets changed to

module Foo exposing (Foo)

import Internal

type alias Foo =
     Internal.Foo
module Internal exposing (Foo)

type Foo =
     Foo Int

where Internal is not in "exposed-modules". Conceptually, this doesn't change anything for the calling code of this package, as it is still the same type, just it's implementation details changed slightly (but being able to do that was the point of making it opaque in the first place). As such, this should be a PATCH change.

However, elm diff gives:

---- Foo - MAJOR ----

    Added:
        type alias Foo =
            Internal.Foo 

    Removed:
        type Foo
  • Elm: 0.19
  • Operating System: OSX 10.14.3
@drathier
Copy link

drathier commented Aug 9, 2019

Changing the custom type to a type alias essentially exposes a constructor to it, so it makes sense the way it is now. Recusing down the types to figure out if it's possible to actually construct that type alias is probably quite a lot of effort.

@harrysarson
Copy link

Changing the custom type to a type alias essentially exposes a constructor to it

In which case should this be a MINOR change, equivalent to adding a new function?

@gampleman
Copy link
Contributor Author

I don’t believe this is true: the constructor is not exposed in either scenario.

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