Opened 3 years ago

Closed 3 years ago

#10335 closed bug (fixed)

Failure to construct superclasses in instance

Reported by: simonpj Owned by:
Priority: normal Milestone: 7.10.2
Component: Compiler Version: 7.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: typecheck/should_compile/T10335
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Consider

{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, ConstraintKinds #-}

module Foo where

class Eq a => C a b

type X a = (Eq a, Show a)

instance X a => C a [b]

HEAD gives

Foo.hs:8:10:
    Could not deduce (Eq a)
      arising from the superclasses of an instance declaration
    from the context: X a
      bound by the instance declaration at Foo.hs:8:10-23
    Possible fix: add (Eq a) to the context of the instance declaration
    In the instance declaration for ‘C a [b]’

This is fall-out from refactoring the silent-superclass story. Patch coming.

Change History (3)

comment:1 Changed 3 years ago by Simon Peyton Jones <simonpj@…>

In 646866ff318d6eb8beeed98032644182dd9d997b/ghc:

Fix superclass generation in an instance

More fallout from the silent-superclass refactoring; nothing drastic.
Fixes Trac #10335.

comment:2 Changed 3 years ago by simonpj

Status: newmerge
Test Case: typecheck/should_compile/T10335

Fixed, although the patch probably won't apply very nicely to 7.10.2, because it meddles with TcEvidence which has changed since 7.10.

But this patch effectively reverts one of the changes to TcEvidence so while it won't apply automatically, it won't be hard either. I'm inclined to think it's worth merging. I can help.

Simon

comment:3 Changed 3 years ago by thoughtpolice

Milestone: 7.10.2
Resolution: fixed
Status: mergeclosed

Merged to ghc-7.10.

Note: See TracTickets for help on using tickets.