Analysis of Elm core issues and patches

Not sure if I remember correctly, but is not the modBy 0 1 runtime exception an expected behavior? I think this was left as it is for performances reason. If performance is not needed, it is possible to wrap it in a safeModBy that adds a check for the parameter to be non-zero.

safeModBy : Int -> Int -> Maybe Int
safeModBy a b =
    if a == 0 then
        Nothing

    else
        Just (modBy a b)

Maybe unsafeModBy could be a better name for modBy?

It would be interesting to prioritize issues based on several factors. For example: do they have a workaround? How expensive is it? How popular is the package/function with the issue?

4 Likes