RE: inferred type doesn't type-check (using type families)

2009-11-04 Thread Simon Peyton-Jones
| I think (untested) that in this particular case you can get around the | problem using scoped type variables: | | > g :: forall a. Num a => T a -> T a | > g x = f x (42 :: a) | | In fact, this seems to be the general pattern for fixing problems like | this with type families: add extra "witness

Re: inferred type doesn't type-check (using type families)

2009-11-03 Thread David Menendez
On Tue, Nov 3, 2009 at 3:20 PM, Max Bolingbroke wrote: > 2009/11/3 Daniel Fischer : >> Am Dienstag 03 November 2009 19:28:55 schrieb Roland Zumkeller: >>> Hi, >>> >>> Compiling >>> >>> > class WithT a where >>> >   type T a >>> > >>> > f :: T a -> a -> T a >>> > f = undefined >>> > >>> > g x = f x

Re: inferred type doesn't type-check (using type families)

2009-11-03 Thread Max Bolingbroke
2009/11/3 Daniel Fischer : > Am Dienstag 03 November 2009 19:28:55 schrieb Roland Zumkeller: >> Hi, >> >> Compiling >> >> > class WithT a where >> >   type T a >> > >> > f :: T a -> a -> T a >> > f = undefined >> > >> > g x = f x 42 >> >> with -XTypeFamilies -fwarn-missing-signatures gives: >> >>  

Re: inferred type doesn't type-check (using type families)

2009-11-03 Thread Daniel Fischer
Am Dienstag 03 November 2009 19:28:55 schrieb Roland Zumkeller: > Hi, > > Compiling > > > class WithT a where > > type T a > > > > f :: T a -> a -> T a > > f = undefined > > > > g x = f x 42 > > with -XTypeFamilies -fwarn-missing-signatures gives: > > Inferred type: g :: forall a. (N