Skip to content
  • sheaf's avatar
    e471a680
    Levity-polymorphic arrays and mutable variables · e471a680
    sheaf authored and Marge Bot's avatar Marge Bot committed
    This patch makes the following types levity-polymorphic in their
    last argument:
    
      - Array# a, SmallArray# a, Weak# b, StablePtr# a, StableName# a
    
      - MutableArray# s a, SmallMutableArray# s a,
        MutVar# s a, TVar# s a, MVar# s a, IOPort# s a
    
    The corresponding primops are also made levity-polymorphic, e.g.
    `newArray#`, `readArray#`, `writeMutVar#`, `writeIOPort#`, etc.
    
    Additionally, exception handling functions such as `catch#`, `raise#`,
    `maskAsyncExceptions#`,... are made levity/representation-polymorphic.
    
    Now that Array# and MutableArray# also work with unlifted types,
    we can simply re-define ArrayArray# and MutableArrayArray# in terms
    of them. This means that ArrayArray# and MutableArrayArray# are no
    longer primitive types, but simply unlifted newtypes around Array# and
    MutableArrayArray#.
    
    This completes the implementation of the Pointer Rep proposal
      https://github.com/ghc-proposals/ghc-proposals/pull/203
    
    Fixes #20911
    
    -------------------------
    Metric Increase:
        T12545
    -------------------------
    
    -------------------------
    Metric Decrease:
        T12545
    -------------------------
    e471a680
    Levity-polymorphic arrays and mutable variables
    sheaf authored and Marge Bot's avatar Marge Bot committed
    This patch makes the following types levity-polymorphic in their
    last argument:
    
      - Array# a, SmallArray# a, Weak# b, StablePtr# a, StableName# a
    
      - MutableArray# s a, SmallMutableArray# s a,
        MutVar# s a, TVar# s a, MVar# s a, IOPort# s a
    
    The corresponding primops are also made levity-polymorphic, e.g.
    `newArray#`, `readArray#`, `writeMutVar#`, `writeIOPort#`, etc.
    
    Additionally, exception handling functions such as `catch#`, `raise#`,
    `maskAsyncExceptions#`,... are made levity/representation-polymorphic.
    
    Now that Array# and MutableArray# also work with unlifted types,
    we can simply re-define ArrayArray# and MutableArrayArray# in terms
    of them. This means that ArrayArray# and MutableArrayArray# are no
    longer primitive types, but simply unlifted newtypes around Array# and
    MutableArrayArray#.
    
    This completes the implementation of the Pointer Rep proposal
      https://github.com/ghc-proposals/ghc-proposals/pull/203
    
    Fixes #20911
    
    -------------------------
    Metric Increase:
        T12545
    -------------------------
    
    -------------------------
    Metric Decrease:
        T12545
    -------------------------
Loading