[Haskell-cafe] [Haskell] Rank-N types with (.) composition

Henning Thielemann lemming at henning-thielemann.de
Wed Feb 11 09:53:08 UTC 2015


On Wed, 11 Feb 2015, Simon Peyton Jones wrote:

> ($) has its own *typing rule*; it does not have a special type.  It's 
> very ad hoc, but ($) is used so much to decrease parens that (e1 $ e2) 
> is almost special syntax!

I already wondered why

   runST $ do
      foo
      bar

worked in some versions of GHC and not in others. I guess it is better to 
tell the programmer the truth, i.e. remove the special treatment of ($). 
If you save a programmer from wondering about why "runST $ do ... " does 
not work with the special typing rule for ($), the programmer will later 
wonder why (.) does not work or why his privately defined function 
application operator (e.g. for reversed order of argument and function) 
will not work.

I think that I stay with "runST (do ...)" in order to be compatible with 
several GHC versions.


More information about the Haskell-Cafe mailing list