[Haskell-cafe] idea for avoiding temporaries

John Meacham john at repetae.net
Thu Mar 8 15:20:29 EST 2007

it seems we can almost do this now without adding any new API calls,
just have 'thawArray' and 'freezeArray' perform the check, and behave
like 'unsafeThawArray' or 'unsafeFreezeArray' when they are the only

The compiler may even be able to statically replace some
calls to thawArray or freezeArray with the unsafe versions with an
extension of the rules syntax

{-# RULES forall a | unique a . freezeArray a = unsafeFreezeArray a #-}

this syntax actually came up in a previous discussion about wanting to
fire rules only when the argument is a constant literal (though, you don't
care about the particular constant value it is)

I imagine infering the uniqueness of values shouldn't be that hard as a
form of it is already done for avoiding thunk-updates.


John Meacham - ⑆repetae.net⑆john⑈

More information about the Haskell-Cafe mailing list