#2037: Inner type declaration causes GHC panic
----------------------------------------+-----------------------------------
    Reporter:  basvandijk               |        Owner:       
        Type:  bug                      |       Status:  new  
    Priority:  normal                   |    Milestone:       
   Component:  Compiler (Type checker)  |      Version:  6.8.2
    Severity:  blocker                  |   Resolution:       
    Keywords:                           |     Testcase:       
Architecture:  x86                      |           Os:  Linux
----------------------------------------+-----------------------------------
Comment (by basvandijk):

 I just discovered a bug in my module:

 All the applications of 'union' in 'unify' have to be replaced by
 'unionWithKey f' like so:
 {{{
 unify :: k ->  Value k a -> Value k a -> Value k a
 unify x (NoValue   dl)      (NoValue dr)      = NoValue(unionWithKey f dl
 dr)
 unify x (NoValue   dl)      (AValue (dr, yr)) = AValue (unionWithKey f dl
 dr, yr)
 unify x (AValue   (dl, yl)) (NoValue dr)      = AValue (unionWithKey f dl
 dr, yl)
 unify x (AValue   (dl, yl)) (AValue (dr, yr)) = AValue (unionWithKey f dl
 dr, f x yl yr)
 }}}
 The interesting thing is that with this the module compiles just fine!

 Of course the orginal bug is still a bug. It probably has something to do
 with the interaction between the explicit type of 'unify' and the type of
 'union'. It also doesn't matter if I add a 'forall k a' to 'union'.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2037#comment:2>
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