Opened 7 years ago

Closed 7 years ago

#2037 closed bug (duplicate)

Inner type declaration causes GHC panic

Reported by: basvandijk Owned by:
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 6.8.2
Keywords: Cc: v.dijk.bas@…
Operating System: Linux Architecture: x86
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

I get a GHC panic when compiling the attached module.

Sorry for the big module but I wasn't able to isolate this to a single simple function.

If I comment the inner type of 'unify' on line 112 the module compiles just fine. So it probably has to do with lexically-scoped type variables.

Attachments (1)

Dict.hs (4.0 KB) - added by basvandijk 7 years ago.
Just a module I was working on when this bug occurred

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by basvandijk

Just a module I was working on when this bug occurred

comment:1 Changed 7 years ago by basvandijk

  • Cc v.dijk.bas@… added

comment:2 Changed 7 years ago 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'.

comment:3 Changed 7 years ago by igloo

  • difficulty set to Unknown
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the report. This looks like a duplicate of #2030 to me. If you also use -XRelaxedPolyRec then the module is accepted, and the HEAD accepts it as-is.

Note: See TracTickets for help on using tickets.