#4494: Another regression with type families
----------------------------------------+-----------------------------------
Reporter: rl | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type checker) | Version: 7.1
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: GHC rejects valid
program
----------------------------------------+-----------------------------------
Comment(by simonpj):
I tried
{{{
{-# LANGUAGE TypeFamilies, RankNTypes, FlexibleContexts,
NoScopedTypeVariables #-}
module T4494 where
type family H s a b
class D (G v) => C v where
type G v
type F v
foo :: v -> H (F v) (G v) v
class D s where
bar :: (forall t. Maybe t -> a) -> s -> H a s r -> r
call :: forall v. C v => F v -> v
call x = bar' (\_ -> x)
(undefined :: G v)
(foo (undefined :: v))
bar' :: C v => (forall t. Maybe t -> F v) -> G v -> H (F v) (G v) v -> v
bar' = bar
}}}
and got this from HEAD
{{{
T4494.hs:17:16:
Could not deduce (G v ~ G v2) from the context (C v2)
NB: `G' is a type function, and may not be injective
In the second argument of `bar'', namely `(undefined :: G v)'
In the expression:
bar' (\ _ -> x) (undefined :: G v) (foo (undefined :: v))
In an equation for `call':
call x = bar' (\ _ -> x) (undefined :: G v) (foo (undefined :: v))
T4494.hs:18:16:
Could not deduce (H (F v2) (G v2) v2 ~ H (F v1) (G v1) v1)
from the context (C v2)
NB: `H' is a type function, and may not be injective
In the third argument of `bar'', namely `(foo (undefined :: v))'
In the expression:
bar' (\ _ -> x) (undefined :: G v) (foo (undefined :: v))
In an equation for `call':
call x = bar' (\ _ -> x) (undefined :: G v) (foo (undefined :: v))
}}}
and this from 6.12.3:
{{{
T4494.hs:18:15:
Couldn't match expected type `H (F v2) (G v2) v2'
against inferred type `H (F v1) (G v1) v1'
NB: `H' is a type function, and may not be injective
In the third argument of `bar'', namely `(foo (undefined :: v))'
In the expression:
bar' (\ _ -> x) (undefined :: G v) (foo (undefined :: v))
In the definition of `call':
call x = bar' (\ _ -> x) (undefined :: G v) (foo (undefined :: v))
T4494.hs:18:15:
Couldn't match expected type `G v2' against inferred type `G v'
NB: `G' is a type function, and may not be injective
In the third argument of `bar'', namely `(foo (undefined :: v))'
In the expression:
bar' (\ _ -> x) (undefined :: G v) (foo (undefined :: v))
In the definition of `call':
call x = bar' (\ _ -> x) (undefined :: G v) (foo (undefined :: v))
}}}
Perhpas you can show ''exactly'' what you are doing, just as I am?
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4494#comment:4>
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