How else? ;-)

Thanks,

Michael

--- On Sun, 6/28/09, Brandon S. Allbery KF8NH <[email protected]> wrote:

From: Brandon S. Allbery KF8NH <[email protected]>
Subject: Re: [Haskell-cafe] What is an "expected type" ...
To: "michael rice" <[email protected]>
Cc: "Brandon S. Allbery KF8NH" <[email protected]>, "Joe Fredette" 
<[email protected]>, [email protected], "Haskell Cafe mailing list" 
<[email protected]>
Date: Sunday, June 28, 2009, 12:06 PM

On Jun 28, 2009, at 12:02 , michael rice wrote:dec2bin :: Integer -> [Integer]
dec2bin n = dec2bin' n []
            where dec2bin' n acc
                    | n == 0 = acc
                    | otherwise = let r = rem n 2
                                      m = div (n - r) 2
                                  in dec2bin' m (r : acc)

is there any way to assign a type signature to the helper function?

Same way you do for a top level binding:
dec2bin :: Integer -> [Integer]
dec2bin n = dec2bin' n []
            where dec2bin' :: Integer -> [Integer] -> [Integer]
                  dec2bin' n acc
                    | n == 0 = acc
                    | otherwise = let r = rem n 2
                                      m = div (n - r) 2
                                  in dec2bin' m (r : acc)
 -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] 
[email protected] administrator [openafs,heimdal,too many hats] 
[email protected] and computer engineering, carnegie mellon 
university    KF8NH
 



      
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to