Skip to content

Incorrect assumptions from BoundedEnum laws. #27

Closed
@MaloJaffre

Description

@MaloJaffre

These instances / functions all require that fromEnum bottom == 0 to work properly, although there is no law to enforce this:

  • BoundedEnum (Maybe a)
  • BoundedEnum (Either a b)
  • BoundedEnum (Tuple a b)
  • defaultToEnum
  • defaultFromEnum
  • toEnumWithDefaults

Two ways to fix this:

  • Add fromEnum bottom == 0 law, this is commonly true, but e. g. not in purescript-dom

  • Rework these instances / functions to work in these edges cases, adding / substracting fromEnum bottom in fromEnum / toEnum respectively.

Unfortunately these are IMO breaking changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions