The rem in Haskell behaves just like the % in JavaScript. When using the clock analogy rem always goes clock-wise regardless if the value is positive or negative. rem takes the sign of the divident
divident / divisor = quotient
Prelude> 10 `rem` 3
1
Prelude> -10 `rem` 3
-1
% in JavaScript works the same way
$ node
> 10 % 3
1
> -10 % 3
-1
mod behaves like rem when both values are positive. The only difference is that when one of the numbers is negative mod goes backwards on the clock, not clock-wise and takes the sign of the divisor.
Knowing that mod and rem give the same result when both numbers are positive which one is recommended to be used in Haskell?