RE: type specs not making it in to functions

2002-01-28 Thread Simon Peyton-Jones
| > I can then say: | > | > > bar :: C a => a -> Int | > > bar (x :: a) = foo (undefined :: a) | > | > But not: | > | > > bar :: C a => a -> Int | > > bar x = foo (undefined :: a) | > | > because it tries to use a new scope for the type variable a and | > doesn't unify it with the one in the

Re: type specs not making it in to functions

2002-01-28 Thread Fergus Henderson
On 25-Jan-2002, Hal Daume III <[EMAIL PROTECTED]> wrote: > consider the following definition: > > > class C a where foo :: a -> Int > > instance C Bool where foo _ = 5 > > I can then say: > > > bar :: C a => a -> Int > > bar (x :: a) = foo (undefined :: a) > > But not: > > > bar :: C a => a -

Re: type specs not making it in to functions

2002-01-25 Thread Ashley Yakeley
At 2002-01-25 14:00, Hal Daume III wrote: >> class D a where constMember :: Int >> instance D Int where constMember = 8 > >It seems ehre that there's no way to extract constMember for a >/particular/ class, since you can't tell it what "a" is supposed to >be. So, instead, I do: > >> class D a wh

type specs not making it in to functions

2002-01-25 Thread Hal Daume III
consider the following definition: > class C a where foo :: a -> Int > instance C Bool where foo _ = 5 I can then say: > bar :: C a => a -> Int > bar (x :: a) = foo (undefined :: a) But not: > bar :: C a => a -> Int > bar x = foo (undefined :: a) because it tries to use a new scope for the t