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] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH


Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to