MArray and runST

Dean Herington heringto@cs.unc.edu
Thu, 13 Feb 2003 09:54:27 -0500


Keean Schupke wrote:

> Ahh, I see, perhaps you could give me a clue as to why (or how) this
> works...
> I have probably become a little over keen on using '$' as a general
> replacement for
> braces '(' ')'  - the '$' was there because the actual wrapper function
> takes arguments and
> it looks neater not to have too many nested braces. I thought this could
> be something to do
> with runST enforcing strictness, but '$!' causes the same problem, only
> runST (wrapper x y z)
> appears to work - if its not too much trouble, how does runSTs type
> enforce this, and why does
> using '$' and '$!' cause type leakage?

Coincidentally, I tripped over this subtlety myself just last night.  (I,
too, often use '$' to avoid nested parentheses.)  I concluded it was an
instance of the "partial-application restriction" that I found described in
section 7.11.4 of the GHC 5.02 User's Guide (still accessible at the GHC web
site if you look carefully enough).

[Simon: With a few minutes scanning, I couldn't find the same text in the
current online User's Guide.  Can you point out where it is?]

-- Dean