Skip to content

Levity-polymorphic arrays and mutable variables

sheaf requested to merge sheaf/ghc:levpoly-arrays into master

This patch makes the following types levity-polymorphic in their last argument:

  • Array#, SmallArray#, Weak#, StablePtr#, StableName#,

  • MutableArray#, SmallMutableArray#, MutVar#, TVar#, MVar#, IOPort#.

The corresponding primops are also made levity-polymorphic, such as newArray#, readArray#, writeMutVar#, writeIOPort#, etc.

Now that Array# and MutableArray# can hold unlifted types, ArrayArray# and MutableArrayArray# are obsolete. So this patch defines them in base; they are no longer primitive types. All the associated operations on ArrayArray# and MutableArrayArray# are defined in base too, instead of being primitive operations.

Subsumes !5218 (closed).

Edited by sheaf

Merge request reports