I recently started learning Elm. When I saw the Int type I assumed it was something like Haskell's Int, which is (I think) a machine integer.
But I was surprised to see this:
> Result.withDefault 0 <| String.toInt "-"
NaN : Int
NaN is a floating point concept which seems like it shouldn't apply to integers. It seems like this might be leaking in from JS, which would imply that Int is represented as a JS Number.
Is that the case? Why was this design decision made, and where can I go to learn about it?
(Also, two minor questions:
- Why isn't
NaNa valid literal? - How do I check to ensure my
Intvalue isn't aNaN? The functionisNaNis of typeFloat -> Boolhttp://package.elm-lang.org/packages/elm-lang/core/latest/Basics#isNaN
)