I am trying to load the following program
gcd a b = if b == 0
then a
else gcd b (rem a b)
But I get the error
Prelude> :l euclidean.hs
[1 of 1] Compiling Main ( euclidean.hs, interpreted )
euclidean.hs:3:8:
Ambiguous occurrence `gcd'
It could refer to either `Main.gcd', defined at euclidean.hs:1:0
or `Prelude.gcd', imported from Prelude
Failed, modules loaded: none.
I changed the function name from gcd
to main
and I get
Couldn't match expected type `IO t'
against inferred type `a -> a -> a'
In the expression: main
When checking the type of the function `main'
Failed, modules loaded: none.
I dont understand this. I am using the workshop step here.