Re[4]: [Haskell-cafe] newbie type signature question

2006-06-13 Thread Bulat Ziganshin
Hello Brian, Tuesday, June 13, 2006, 1:11:37 AM, you wrote: data UTF8Stream h = (ByteStream h) = UTF8Stream h instance TextStream (UTF8Stream h) ... addUTF8Encoding :: h - (UTF8Stream h) and so on. currently i should add type constraint to each and every class and function i declared.

RE: [Haskell-cafe] newbie type signature question

2006-06-12 Thread Simon Peyton-Jones
you need at least one constructor if you say 'where'. S | -Original Message- | From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brock | Peabody | Sent: 09 June 2006 20:34 | To: haskell-cafe@haskell.org | Subject: RE: [Haskell-cafe] newbie type signature question

Re: Re[2]: [Haskell-cafe] newbie type signature question

2006-06-12 Thread Brian Hulley
Bulat Ziganshin wrote: Hello Brian, Saturday, June 10, 2006, 3:05:25 AM, you wrote: It is possible that this feature was added to the language for the benefit of people who prefer not to use explicit type signatures but afaiu this goes against best practice where everything should always have

Re[2]: [Haskell-cafe] newbie type signature question

2006-06-10 Thread Bulat Ziganshin
Hello Brian, Saturday, June 10, 2006, 3:05:25 AM, you wrote: It is possible that this feature was added to the language for the benefit of people who prefer not to use explicit type signatures but afaiu this goes against best practice where everything should always have an explicit

Re: [Haskell-cafe] newbie type signature question

2006-06-10 Thread J. Garrett Morris
On 6/9/06, Brandon Moore [EMAIL PROTECTED] wrote: data DataType m = forall m' . (Monad m') = DataType (TyEq m m') (Char - m' ()) It appears that the more intuitive formulation: data DataType m where DataType :: Monad m = (Char - m ()) - DataType m should work in GHC 6.4 /g

RE: [Haskell-cafe] newbie type signature question

2006-06-10 Thread Brock Peabody
Brian Hulley wrote: Don't put class constraints on a data type, constraints belong only to the functions that manipulate the data. So according to this guideline you're not supposed to think of associating contraints with data: constraints are only relevant for functions which

RE: Re[2]: [Haskell-cafe] newbie type signature question

2006-06-10 Thread Brock Peabody
From: Bulat Ziganshin [mailto:[EMAIL PROTECTED] when you work with C++ or some other OOP language, you can define that some field in structure should some some specific interface and this allows to use functions of this interface on this field. i required the same feature in Haskell, for

[Haskell-cafe] newbie type signature question

2006-06-09 Thread Brock Peabody
Please excuse my newbiness, but in this snippet: data (Monad m) = DataType m = DataType { f :: Char - m () } test_function :: (Monad m) = DataType m - m () test_function d = f d 'C' Why is (Monad m) = required, when the definition

Re: [Haskell-cafe] newbie type signature question

2006-06-09 Thread Brian Hulley
Brock Peabody wrote: Please excuse my newbiness, but in this snippet: data (Monad m) = DataType m = DataType { f :: Char - m () } test_function :: (Monad m) = DataType m - m () test_function d = f d 'C' Why is (Monad m) = required, when the definition

RE: [Haskell-cafe] newbie type signature question

2006-06-09 Thread Brock Peabody
Brian Hulley wrote: There was a post a while back (unfortunately I can't seem to locate it) where someone posted a link to some guidelines on haskell coding style where one guideline was never to use contexts in data declarations. I would love to see that guideline. What is the correct way

RE: [Haskell-cafe] newbie type signature question

2006-06-09 Thread Brock Peabody
From: Brandon Moore Getting them both is tricky, but you can do it if you use a GADT to write a type that means exists a such that a = m and a is a Monad: Is GADT a way to assemble types at compile-time? It looks really cool. {-# OPTIONS -fglasgow-exts #-} data TyEq (a :: * - *) (b :: * -

Re: [Haskell-cafe] newbie type signature question

2006-06-09 Thread Brandon Moore
Sorry, I meant to send this to the whole list. Brock Peabody wrote: Please excuse my newbiness, but in this snippet: data (Monad m) = DataType m = DataType { f :: Char - m () } test_function :: (Monad m) = DataType m - m ()

Re[2]: [Haskell-cafe] newbie type signature question

2006-06-09 Thread Bulat Ziganshin
Hello Brian, Friday, June 9, 2006, 9:50:30 PM, you wrote: data (Monad m) = DataType m = DataType { f :: Char - m () } test_function :: (Monad m) = DataType m - m () There was a post a while back (unfortunately I can't seem to locate it) where someone