incipit-base-0.3.0.0: A Prelude for Polysemy – Base Reexports
Safe HaskellSafe-Inferred
LanguageHaskell2010

Incipit.Integral

Description

Safe overrides of the methods of class Integral.

Synopsis

Documentation

safeOp :: Eq a => Num a => (a -> a -> b) -> a -> a -> Maybe b Source #

Helper for operations that return Nothing if the second operand is 0.

quot :: Integral a => a -> a -> Maybe a Source #

integer division truncated toward zero

rem :: Integral a => a -> a -> Maybe a Source #

integer remainder, satisfying

(x `quot` y)*y + (x `rem` y) == x

div :: Integral a => a -> a -> Maybe a Source #

integer division truncated toward negative infinity

mod :: Integral a => a -> a -> Maybe a Source #

integer modulus, satisfying

(x `div` y)*y + (x `mod` y) == x

quotRem :: Integral a => a -> a -> Maybe (a, a) Source #

simultaneous quot and rem

divMod :: Integral a => a -> a -> Maybe (a, a) Source #

simultaneous div and mod