In Haskell,
This works perfectly fine:(mod 9) 7
. It gives the expected result: remainder when 9 is divided by 7 (2).
Similarly, this works too:(mod 9) 9
. It returns 0.
This led me to think that (mod 9 == 0) 9
should return True
. However, that hasn't been the case: it threw up an error instead.
THE ERROR:
<interactive>:62:1: error:
• Couldn't match expected type ‘Integer -> t’
with actual type ‘Bool’
• The function ‘mod 9 == 0’ is applied to one argument,
but its type ‘Bool’ has none
In the expression: (mod 9 == 0) 9
In an equation for ‘it’: it = (mod 9 == 0) 9
• Relevant bindings include it :: t (bound at <interactive>:62:1)
Please help me understand why (mod 9 == 0) 9
wouldn't return True
.
P.S.: I'm convinced that my usage of "return" in Haskell's context is flawed. However, I am just starting out, so please excuse me. (Would be nice if you could correct me if I am, indeed, wrong.)