Weird not & modBy result

So I’m working through the Elm track on Exercism using Elm 0.19. I encountered the strangest thing while solving the Leap exercise.

I have the following functions, which I expect to be equivalent:

f1 : Int -> Bool
f1 year =
    modBy 3 year /= 0

f2 : Int -> Bool
f2 year =
    not (modBy 3 year == 0)

However, this test shows that they’re not:

Expect.equal (Leap.f1 1) (Leap.f2 1)

The output is:

True
╷
│ Expect.equal
╵
1

I don’t even know what that 1 is doing there, since both functions return Bool?

I’m sure I’m missing something obvious, can someone explain the behaviour I’m seeing?

Thanks!

This is a known bug that will be fixed in the next release:

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.