
5 Feb
2015
5 Feb
'15
7:26 a.m.
"Roelof Wobben":
I have this :
-- | Main entry point to the application. module Main where
-- | convert a number to a array in pieces where a negative number will
be a empty array.
toDigits :: Integer -> [Integer] toDigits n | n < 0 = [] | otherwise = n/10 : []
-- | The main entry point. main :: IO () main = do toDigits 123
First of all, what do you expect from your program? The problem with your code is that `main` declares type `IO ()` in its signatures but its body has another type, [Integer]. What do you think is wrong with the compiler's output? -- Nadir