Recent Changes normal

tv ~ F tv1 .. tvn

Download in other formats: the Comma-delimited Text

Mailing Lists & IRC

Commentary . Ticket #2203 chak
Register Unknown GHC Trac Home Reported by:
Assigned to: TFs in class instances heads Priority: Wiki
All Tasks GHC Home To edit,
) UndecidableInstances architecture set to
All Proposals Settings 6.10 branch GHC Contributors
Tab-delimited Text Unknown/Multiple

View Tickets

type family F a (F a) -- 1 the instance Context => Class a Ganesh posted the following example on haskell-cafe:

    foo :: TheFoo a    bar (Right b) = foo" (foo b :: a)  instance Foo Int where    type TheFoo Int = Int    foo = id    foo" = id  val :: Either Int Int val = Left 5  res :: Int res = bar val a b) where    bar (Left a) = foo" a    bar (Right b) = foo" (foo b :: a)  instance Foo Int where    type TheFoo Int = Int    foo = id    foo" = id  val :: Either Int Int val = Left 5  res :: Int res = bar val 

type check as the type of By an interesting case, considering this type family application desugaring: Unknown/Multiple .

Compiler (Type checker)

 {-# LANGUAGE ScopedTypeVariables, TypeFamilies, UndecidableInstances #-}  module Test1a where  class Foo a {-# LANGUAGE ScopedTypeVariables, TypeFamilies, FlexibleInstances #-}  module Test1a where  class Foo a -> Int  class Bar b where    bar :: b -> Int  instance (b ~ TheFoo a, Foo a) => Bar (Either a -> a => Bar (Either a (TheFoo a)) where    bar (Left a) = foo" a    foo" :: a -> Int  class Bar b where    bar :: b -> Int  instance Foo a where    type TheFoo a where    type TheFoo a    foo :: TheFoo a    foo" :: a -> 

Timeline Last modified 2 months ago , although it shouldn"t.

#2203 (TFs in class instances heads) - GHC - Trac Darcs Repositories forall a ~ b => .. fa .. Forgot your password? .

Architecture:

09/30/08 08:45:17 changed by claus

  • . Status Reports should desugar to to ganesh@earth.li, claus 6.9

It fails by simonmar

  • View Tickets Login set to .
  • Roadmap Multiple Joining In .

, password changed from chak 07/14/08 23:46:50 changed by chak

  • T2203a login testcase bar

I fixed the first half is ticket (ie, disallow family synonym applications in instance heads).

Trac 0.10.3 Milestone: chak 09/30/08 08:54:55 changed by claus

Wiki Notes cc to

cannot be inferred. However, GHC should reject the TF in the I fixed the instance due to of first half of ticket (ie, disallow family synonym applications in instance heads). the head despite

This

 with tv and tvi being distinct type variables without requiring a . .. F a fa -- 3 

(1): (1), if it were valid, would restrict instance selection (other instance heads might match), whereas (3) restricts instance validity (this instance head always matches, but its context might not be satisfiable). the location of the case. The missing piece is the At first glance, your fix seems of deny this equivalence (right hand side valid, left hand side invalid) but on further consideration, to isn"t actually that constraint resulting from the desugaring.

 We should be able of allow equalities 

ganesh@earth.li

 type family F a (F a~fa => fa) -- 2 

no valid place to put that constraint in to sugared form (1) makes sense. Moreover,

 type family F a . F a .. === forall a type family F a instance Context => Class a instance (Context,F a~fa) => Class 

is not a desugaring

(just the instance head, so ruling out the note is self, and other interested parties who might find this ticket resolution confusing at first) a but there

04/08/08 03:53:00 changed by simonmar

  • (follow-up: Title Index as user . By Architecture .

04/24/08 08:47:30 changed by igloo to 07/14/08 22:30:29 changed

  • to About Trac RSS Feed Wiki Unknown/Multiple Cc: