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

Christian Hofer Christian.Hofer at gmx.de
Fri Dec 24 10:04:44 EST 2004

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 (implementing my Java 
homework in the imperative language of my choice)...

Merry christmas,

Am 24.12.2004 um 14:33 schrieb 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 #-}
> add :: Num a => a -> a -> a
> add (n1::a) n2 = addToN1 n2
>    where addToN1 :: a -> a
>          addToN1 number = n1 + number

More information about the Haskell-Cafe mailing list