Skip to content

Implement Array's Unfoldable instance via ST after shuffling around dependencies #40

@JordanMartinez

Description

@JordanMartinez

If this instance was implemented via ST, then purescript-backend-optimizer would inline things when possible.

However, it seems that we can't currently do this because arrays depends on nonempty, which depends on unfoldable. AFAIK, this dependency chain exists because arrays has functions like fromNonEmpty, though I don't think anyone uses NonEmpty Array.

flowchart TD
  arrays ---> nonempty
  nonempty ---> unfoldable
Loading

If we updated arrays to depend on unfoldable and nonempty to depend on arrays, then we could add an Unfoldable instance for Array that uses ST

flowchart TD
  nonempty ---> arrays
  arrays ---> unfoldable
Loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: breaking changeA change that requires a major version bump.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions