Does Haskell provide any constants for knowing the limits of Int? I understand Int is platform-dependent, but nevertheless I would like to utilize it and to initialize some values at the extremes in my particular case. The equivalent constants (for instance) in C would be INT_MAX and INT_MIN.
Does Haskell provide any constants for knowing the limits of Int ? I understand
Share
The maximum and minimum bounds for different types are accessed via the
Boundedtype-class using the valuesminBoundandmaxBound.The values are polymorphic based on the context they are in, so in some cases you might have to explicitly indicate the type if the compiler is unable to infer it. E.g.