#5596: "f c = a $ b c", "f = a . b" does not.
----------------------------------------+-----------------------------------
  Reporter:  guest                      |          Owner:                
      Type:  bug                        |         Status:  closed        
  Priority:  normal                     |      Milestone:                
 Component:  Compiler (Type checker)    |        Version:  7.2.1         
Resolution:  invalid                    |       Keywords:                
  Testcase:                             |      Blockedby:                
Difficulty:                             |             Os:  Linux         
  Blocking:                             |   Architecture:  x86_64 (amd64)
   Failure:  GHC rejects valid program  |  
----------------------------------------+-----------------------------------
Changes (by simonpj):

  * status:  new => closed
  * resolution:  => invalid


Comment:

 Yes, this is bad, but it's because GHC is trying to help!

 Fundamentally, neither `(runST $ f)` nor `(runST . f)` should work,
 because both require calling `($)` or `$(.)` respectively ''at a
 polymorpic type''; that is, they both require impredicative polymoprhism.
 (In earlier versions of GHC Dimitrios and I implemented our
 [http://research.microsoft.com/%7Esimonpj/papers/boxy/ boxy-type paper],
 but the implementation was grotesquely complicated and unpredicatable, so
 we rolled it back.)

 However, the idiom `(runST $ do ...blah...)` had become very common in
 practice, so I added a TOTALLY AD-HOC special case typing rule, for terms
 of the form `(e1 $ e2)`.  In this special se there is no problem with
 impredicativity, so away we go.  And that's why the two differ: there is
 no special case for `(.)`.

 I could compound the problem by adding a special typing rule for `(e1 .
 e2)` as well, but I'm not sure that would really be an improvement.

 The special typing rule for `($)` isn't even documented in the manual,
 because I didn't really want to encourage people to exploit it.  It's a
 secret feature.

 Cf #4295.

 I'll close this as invalid, but acknowledging that things are not great.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5596#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to