When trying to compile my code i'm getting:
[1 of 1] Compiling Main ( survey2.hs, survey2.o )
survey2.hs:20:1:
Couldn't match expected type ‘IO t0’ with actual type ‘Integer’
In the expression: main
When checking the type of the IO action ‘main’
I've tried messing around with specifying the '9' that is being input to main as a bunch of different types including IO, IO t, IO t0, int, etc. I understand that based on the function definitions I have in other places, that if an Integer is not input into the function that none of the other functions will work properly. I'm not sure How to put the proper type into the main.
factorial:: Integer -> Integer
factorial n
| n <= 1 = 1
| otherwise = n * factorial(n-1)
binomial :: (Integer, Integer) -> Integer
binomial (n, k)
| k > n = 0
| k < 0 = 0
| otherwise = factorial(n) / (factorial(n-k) * factorial(k))
bell :: Integer -> Integer
bell n
| n <= 1 = 1
| otherwise = sum [ binomial(n-1, k-1) * bell (k-1) | k<-[0..n-1] ]
bellSum :: Integer -> Integer
bellSum n = sum [ bell(k) | k<-[0..n] ]
main = bell(9 :: Integer )