[Haskell-cafe] Problem with type signature in local function

2004-12-24 Thread Christian Hofer
Hi, in order to understand the reason for strange compiler error messages, I often find it convenient to add type signatures to every function. But sometimes this seems to be impossible when using type variables. I try to give a very easy example: add :: Num a = a - a - a add n1 n2 = addToN1 n2

Re: [Haskell-cafe] Problem with type signature in local function

2004-12-24 Thread Ralf Laemmel
Timely question. :-) GHC supports lexically scoped type variables. And this support has just been _extended_ to be readily useful for you (see discussion on the ghc list just a few days back). With GHC CVS HEAD the following program works fine. (Note that I removed the inner Num constraint.) {-#

Re: [Haskell-cafe] Problem with type signature in local function

2004-12-24 Thread Arthur Baars
You could also do it with the current implementation of scoped type variables. So you don't need to compile the CVS HEAD version. Note that you need the pattern (n1::a) and/or (n2::a) to introduce the scoped type variable, which was not necessary in Ralf's solution. {-# OPTIONS -fglasgow-exts

[Haskell-cafe] Re: Ignorant begginer question

2004-12-24 Thread John Goerzen
On 2004-12-23, Stefan Holdermans [EMAIL PROTECTED] wrote: Your problem right now is that the type Complex takes (needs) a type argument. Its definitions is (module strictness flags): data Complex a = a :+ a What does the :+ mean here? ___

[Haskell-cafe] Re: ANN: MissingH 0.8.0 (Festive Lambda)

2004-12-24 Thread John Goerzen
On 2004-12-24, John Goerzen [EMAIL PROTECTED] wrote: * Virtualized I/O system Use familiar functions to work on not just Handles but all sorts of other types, including in-memory buffers. (HVIO module) I should comment on this... I went with basically what I originally asked about

Re: [Haskell-cafe] Problem with type signature in local function

2004-12-24 Thread Christian Hofer
Thank you all for your answers! I indeed do not want to use CVS HEAD, but it's nice to know that there will be a better solution some time. Until then I will write s.th. like loop (residual :: MutableGraph state node weight) flow absValue = ... which is completely sufficient for my purposes

Re: [Haskell-cafe] Re: Ignorant begginer question

2004-12-24 Thread Jules Bean
On 24 Dec 2004, at 14:53, John Goerzen wrote: On 2004-12-23, Stefan Holdermans [EMAIL PROTECTED] wrote: Your problem right now is that the type Complex takes (needs) a type argument. Its definitions is (module strictness flags): data Complex a = a :+ a What does the :+ mean here? It's a data

Re: [Haskell-cafe] Re: Ignorant begginer question

2004-12-24 Thread Stefan Holdermans
Jules, It's a data constructor, written infix. Infix constructors all begin with ':', I think. That's correct. Regards, Stefan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Ignorant begginer question

2004-12-24 Thread Tomasz Zielonka
On Fri, Dec 24, 2004 at 03:14:34PM +, Jules Bean wrote: It's a data constructor, written infix. Infix constructors all begin with ':', I think. Yes, but you can also use prefix, alphanumeric constructors as infix by placing them in backticks. This can be nice sometimes: data Expr =