[GHC] #1503: GHC doesn't respect monomorphism restrictions for non-type-class-restricted values that are bound

GHC trac at galois.com
Fri Jul 6 20:18:14 EDT 2007


#1503: GHC doesn't respect monomorphism restrictions for non-type-class-restricted
values that are bound
-----------------------------+----------------------------------------------
    Reporter:  Isaac Dupree  |        Owner:         
        Type:  bug           |       Status:  closed 
    Priority:  normal        |    Milestone:         
   Component:  Compiler      |      Version:  6.6.1  
    Severity:  normal        |   Resolution:  invalid
    Keywords:                |   Difficulty:  Unknown
          Os:  Unknown       |     Testcase:         
Architecture:  Unknown       |  
-----------------------------+----------------------------------------------
Changes (by Isaac Dupree):

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

Comment:

 Argh, you're right!  I thought I had read that rule closely enough... I
 wonder if there's some way this can be made more obvious. (1) In the
 Report, don't use the word "restricted" to mean "restricted (to be
 monomorphic) IN SOME CASES" (maybe I'll ask haskell-prime).  (2) the
 unsafeCoerce usage was a real one that confused me for a while.  The only
 real solution I can think of is throwing out the confusing haskell98
 monomorphism restriction in favor of mono-pat-binds... unless someone can
 come up with some kind of warning or error message that makes it clear.
 Usually non-function-, non-pattern-appearing bindings are at least
 constrained.  However there is also the case where it does need to be
 polymorphic (unpacking a newtype that contains a universally quantified
 value, for example).

 Well, at least, I ''think'' I understand what's actually happening a
 little better now... the report never says to generalize things in 'case',
 for example, so they're not generalized... in 3.17.3, case v of { x -> e }
 = ( \ x -> e ) v.  The lambda function, just like a top-level function,
 has the bound variable as a rigid/monomorphic(4.5.4) variable, as inferred
 function types have to be rank-1.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1503>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
-------------- next part --------------
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


More information about the Glasgow-haskell-bugs mailing list