Skip to content

non-breaking type changes should be minor/patch #2208

Open
@lue-bird

Description

@lue-bird

The sem-ver could be less strict when changing the type in a minor way.
Suggestion: Mark the following cases as minor changes:

Going from Specific or constrainedTypeVariable to typeVariable

- ifJust : Maybe Int -> Bool
+ ifJust : Maybe a -> Bool
- nothing : Maybe Int
+ nothing : Maybe a
- empty : List number
+ empty : List a
- sum : List Int -> Int
+ sum : List number -> number
- origin : ( Int, Int )
+ origin : ( number, number )
- sort : List String -> List String
+ sort : List comparable -> comparable

In these two cases, the functions can still be used like in older versions (→ no breaking API change). This does allow for more ways to interact with the API, though → minor change.

An example of where I've come across this is with phantom types, like in typesafe-array.
An example: Every first type argument of Arr will be a In min max. Neither min nor max will be used in the type, so we can simply write length.

- Arr (In min max) ...
+ Arr length ...
  • Elm: 0.19.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions