Function signature clearly states that it should return a Bool so why is the function returning 96? What is more, compiler thinks that 96 is actually a Bool. Is this a bug?
> isLeapYear year =\
| (modBy 4 year == 0) && (modBy 100 year /= 0) || (modBy 400 year == 0)
<function> : Int -> Bool
> isLeapYear 1996
96 : Bool
It seems to work sometimes though:
> isLeapYear 2000
True : Bool
> isLeapYear 1800
False : Bool
This is a compiler bug which I filed last year and which has now been fixed.
It affects only the /=
operator when one argument is 0
: replacing (modBy 100 year /= 0)
with (not (modBy 100 year == 0))
will work around the problem.
The bug has been fixed in the source repository, but I don't know when the fix will be released.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With