[GHC] #9371: Overlapping type families, segafult

GHC ghc-devs at haskell.org
Mon Jul 28 12:44:16 UTC 2014


#9371: Overlapping type families, segafult
----------------------------------------+----------------------------------
              Reporter:  pingu          |            Owner:
                  Type:  bug            |           Status:  new
              Priority:  normal         |        Milestone:
             Component:  Compiler       |          Version:  7.8.3
            Resolution:                 |         Keywords:
      Operating System:  Linux          |     Architecture:  x86_64 (amd64)
       Type of failure:  Runtime crash  |       Difficulty:  Unknown
             Test Case:                 |       Blocked By:
              Blocking:                 |  Related Tickets:
Differential Revisions:                 |
----------------------------------------+----------------------------------

Comment (by simonpj):

 "Fix the conflict checker" is clearly an option.  It's what I described as
 "adding more complexity".

 Moreover, let us note that GHC's current behaviour is not documented in
 the user manual or in any paper.  If you are arguing to stick with it, we
 should at least write it up!  Any volunteers?

 Moreover, doesn't your example work perfectly well without eta reduction?
 To typecheck the `deriving instance` we need
 {{{
   IdentityT [] Int  ~R  IdentityT MyList Int
 }}}
 Now, using the `Coercible` instances in Fig 2 of
 [http://research.microsoft.com/en-
 us/um/people/simonpj/papers/ext-f/coercible.pdf the paper], we can reduce
 that to
 {{{
   [Int] ~R  MyList Int
 }}}
 and that is true with the non-eta-reduced axiom.

 If `IdentityT`'s data constructor was not in scope, then indeed the
 program will still typecheck -- but arguably doing so exposes something
 about the representation of the newtype, harming abstraction.  You
 certainly couldn't have written it be hand.

 It all seems quite debatable to me.  Do we really want a significant
 cluster of complexity in the implementation, to implement an un-documented
 feature, which no one is asking for, and whose very existence is
 debatable?

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


More information about the ghc-tickets mailing list