Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5120 closed bug (fixed)

inferred type of an implicit parameter rejected (associated type)

Reported by: mikkonecny Owned by:
Priority: normal Milestone: 7.2.1
Component: Compiler (Type checker) Version: 7.0.3
Keywords: associated type, implicit parameter Cc:
Operating System: Linux Architecture: x86
Type of failure: None/Unknown Test Case: typecheck/should_compile/T5120
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

The following module:

{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoMonomorphismRestriction #-}

module Test where

class C t where
    type TF t
    ttt :: TF t -> t

b :: (C t, ?x :: TF t) => t
b = ttt ?x 

compiles fine with ghc 6.12.3 but ghc 7.0.3 says:

    Could not deduce (?x::TF t)
      arising from a use of implicit parameter `?x'
    from the context (C t, ?x::TF t)
      bound by the type signature for b :: (C t, ?x::TF t) => t
      at Test.hs:13:1-10
    In the first argument of `ttt', namely `?x'
    In the expression: ttt ?x
    In an equation for `b': b = ttt ?x

Moreover, when I comment out the type declaration for b, ghc 7.0.3 compiles it and the inferred type for b is identical to the one that was commented out:

*Test> :t b
b :: (C t, ?x::TF t) => t

Attachments (1)

Test.hs (219 bytes) - added by mikkonecny 9 years ago.

Download all attachments as: .zip

Change History (3)

Changed 9 years ago by mikkonecny

Attachment: Test.hs added

comment:1 Changed 9 years ago by igloo

Milestone: 7.2.1
Resolution: fixed
Status: newclosed

Thanks for the report. Fixed by changeset:b30f8b6540eb8fe10f06c6e12d0daa08464656c2

commit b30f8b6540eb8fe10f06c6e12d0daa08464656c2
Author: U-EUROPE\dimitris <dimitris@MSRC-1361792.europe.corp.microsoft.com>
Date:   Wed Apr 27 11:04:02 2011 +0100

    Solving one IP from another. This fixes #5120.

comment:2 Changed 9 years ago by simonpj

Test Case: typecheck/should_compile/T5120
Note: See TracTickets for help on using tickets.