morley-prelude-0.5.0: A custom prelude used in Morley
Safe HaskellNone
LanguageHaskell2010

Unsafe

Description

Unsafe utilities.

This module should be imported qualified.

Synopsis

Documentation

Unsafe converters between Integral types checking for overflow/underflow

fromIntegral :: (HasCallStack, Integral a, Integral b) => a -> b Source #

Unsafe converter between Integral types checking for overflow/underflow. Return value if conversion does not produce overflow/underflow and raise an exception with corresponding error message otherwise.

It is needed to replace fromIntegral which misses most of the overflow/underflow checks.

Note the function is strict in its argument.

fromInteger :: (HasCallStack, Integral a) => Integer -> a Source #

Unsafe converter between Integer and Integral types checking for overflow/underflow. Return value if conversion does not produce overflow/underflow and raise an exception with corresponding error message otherwise.

Note the function is strict in its argument.