Implement Array's `Unfoldable` instance via `ST` after shuffling around dependencies
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
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
It also seems like foldable-traversable has instances for Array written in FFI because the instance must be with the class in the same module. So, perhaps we would need to have another package like purescript-array-st where it exposes a mutable array API for use with things like this?