Re: Type class inference trouble

2001-02-19 Thread Lars Lundgren
On Sat, 17 Feb 2001, Ken Shan wrote: > On 2001-02-16T09:52:41+0100, Lars Lundgren wrote: > > This is ad hoc overloading, and IMHO bad style, at least in haskell. As I > > understand it, haskell type classes were never intended to support this. > > Well, whether this is ad hoc overloading depen

Re: Type class inference trouble

2001-02-16 Thread Ken Shan
On 2001-02-16T09:52:41+0100, Lars Lundgren wrote: > This is ad hoc overloading, and IMHO bad style, at least in haskell. As I > understand it, haskell type classes were never intended to support this. Well, whether this is ad hoc overloading depends on whether you find ad hoc this particular theo

Re: Type class inference trouble

2001-02-16 Thread Ken Shan
On 2001-02-16T07:56:42+, Marcin 'Qrczak' Kowalczyk wrote: > > > test2 = apply [int 3] (apply [(+)::Int->Int->Int] [int 5]) > The monomorphism restriction bites again. A variable binding without > a type signature is monomorphic... But, but, but... The type *is* monomorphic, in the sense t

Re: Type class inference trouble

2001-02-15 Thread Marcin 'Qrczak' Kowalczyk
Thu, 15 Feb 2001 21:08:13 -0500, Dylan Thurston <[EMAIL PROTECTED]> pisze: > On Thu, Feb 15, 2001 at 02:37:09PM -0500, Ken Shan wrote: > > test2 = apply [int 3] (apply [(+)::Int->Int->Int] [int 5]) > > What's strange is that when I tried this just now, the identical line at > the interpreter

Re: Type class inference trouble

2001-02-15 Thread Lars Lundgren
On Thu, 15 Feb 2001, Ken Shan wrote: > Hello all, > > I'm trying to implement some simple natural language semantics with > Haskell (Hugs), and I'm running into trouble with type classes. > Here's what I want to do: Suppose that > > x :: a -> b > y :: a > > then I want to write > >

Re: Type class inference trouble

2001-02-15 Thread Ken Shan
On 2001-02-15T21:38:54-0500, Dylan Thurston wrote: > > On Thu, Feb 15, 2001 at 02:37:09PM -0500, Ken Shan wrote: > > > test2 = apply [int 3] (apply [(+)::Int->Int->Int] [int 5]) > > What's strange is that when I tried this just now, the identical line at > > the interpreter prompt returned the

Re: Type class inference trouble

2001-02-15 Thread Dylan Thurston
On Thu, Feb 15, 2001 at 09:08:13PM -0500, Dylan Thurston wrote: > On Thu, Feb 15, 2001 at 02:37:09PM -0500, Ken Shan wrote: > > test2 = apply [int 3] (apply [(+)::Int->Int->Int] [int 5]) > > What's strange is that when I tried this just now, the identical line at > the interpreter prompt retu

Re: Type class inference trouble

2001-02-15 Thread Dylan Thurston
On Thu, Feb 15, 2001 at 02:37:09PM -0500, Ken Shan wrote: > test2 = apply [int 3] (apply [(+)::Int->Int->Int] [int 5]) What's strange is that when I tried this just now, the identical line at the interpreter prompt returned the correct answer [8]. This is with Hugs from February 2000; I'm ab

Type class inference trouble

2001-02-15 Thread Ken Shan
Hello all, I'm trying to implement some simple natural language semantics with Haskell (Hugs), and I'm running into trouble with type classes. Here's what I want to do: Suppose that x :: a -> b y :: a then I want to write apply x y = x y :: b Moreover, if x :: a y :: a -