[Haskell-cafe] Question related to Multi Param Type Classes

2008-05-05 Thread Sai Hemanth K
Hi, I declared a multi param type class as below: *class MyString m c where zIndex :: m - Int - c zLength :: m - Int zPack :: [c] - m zEquals :: c -c - Bool zWrap :: [c] - (m,AnExistingDataType)* In the end I did not needed it for my program, but for those few

Re: [Haskell-cafe] Question related to Multi Param Type Classes

2008-05-05 Thread Bulat Ziganshin
Hello Sai, Monday, May 5, 2008, 7:52:29 PM, you wrote: class MyString m c  where it should be class MyString m c | m-c where so ghc will realize that same m means the same c. read about functional dependencies in ghc user manual -- Best regards, Bulat

Re: [Haskell-cafe] Question related to Multi Param Type Classes

2008-05-05 Thread Ryan Ingram
On 5/5/08, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote: The functional dependency MyString m c | m - c tells GHC that any specific m determines a specific c. It doesn't matter what the type is here, since it's not used in the definition of compareStr; but it must be possible to know that

Re: multi param type classes

1998-07-09 Thread Fergus Henderson
On 08-Jul-1998, Johannes Waldmann [EMAIL PROTECTED] wrote: ... how would you resolve ambiguities? probably by requiring an explicit type signature at the point of usage. fine, but then i'd like to have this in other cases as well, finally arriving at Ada-style overloading (a name may have

Re: multi param type classes

1998-07-09 Thread Fergus Henderson
On 08-Jul-1998, Mariano Suarez Alvarez [EMAIL PROTECTED] wrote: On Wed, 8 Jul 1998 [EMAIL PROTECTED] wrote: Each expression then has a set of possible types, and the ambiguity is resolved by an explicit type signature. At present it is quite frustrating in Haskell that when a name

Re: multi param type classes

1998-07-08 Thread Johannes Waldmann
Ralf, you want to lift this restriction: The type of each class operation must mention all of the class type variables. how would you resolve ambiguities? probably by requiring an explicit type signature at the point of usage. fine, but then i'd like to have this in other cases as well,

Re: multi param type classes

1998-07-08 Thread Ralf Hinze
you want to lift this restriction: The type of each class operation must mention all of the class type variables. how would you resolve ambiguities? probably by requiring an explicit type signature at the point of usage. No longer ;-). I find SPJ's summary on

Re: multi param type classes

1998-07-08 Thread S. Alexander Jacobson
I think Simon or Alastair promised this in 2.0 (though it doesn't appear on the list for 2.0...) -Alex- On Thu, 9 Jul 1998, Fergus Henderson wrote: On 08-Jul-1998, Johannes Waldmann [EMAIL PROTECTED] wrote: ... how would you resolve ambiguities? probably by requiring an explicit type

Query on multi-param type classes

1998-01-30 Thread Jon Mountjoy
Hello, I decided to try and get my old multi-param. parser to work, and got told-off by Haskell's parser: Please tell me what I am doing wrong. The following program: module A where class (Monad m, Monad (t m)) = AMonadT t m where lift :: m a - t m a Gives me: (lambda o) ghc

Re: Query on multi-param type classes

1998-01-30 Thread Ralf Hinze
Dear Jon, dear Simon, class (Monad m, Monad (t m)) = AMonadT t m where lift :: m a - t m a I'm frankly unsure of the consequences of lifting the restriction. Can you give a compact summary of why you want to? Our multi-parameter type-class paper gives none, and if you've got one

Re: Query on multi-param type classes

1998-01-30 Thread Keith S. Wansbrough
A.hs:3:23: parse error on input: "(" I should have said that I've implemented the choices given on the Standard Haskell web discussion page. In particular: === Choice 7a ~ The context in a class declaration (which introduces superclasses) must constrain

Re: Query on multi-param type classes

1998-01-30 Thread Simon L Peyton Jones
I decided to try and get my old multi-param. parser to work, and got told-off by Haskell's parser: Please tell me what I am doing wrong. The following program: module A where class (Monad m, Monad (t m)) = AMonadT t m where lift :: m a - t m a Gives me: (lambda o) ghc