antelude-0.1.0: src/Antelude/Numeric.hs
{- |
Module : Antelude.Numeric
Description : Contains some functions for numeric-types.
Maintainer : dneavesdev@pm.me
-}
module Antelude.Numeric
( P.Double
, P.Float
, P.Floating (..)
, P.Fractional (..)
, P.Int
, P.Integer
, P.Integral (..)
, P.Num (..)
, P.Rational
-- | Reexport from 'Prelude'
, P.fromIntegral
-- | Reexport from 'Prelude'
, P.gcd
-- | Reexport from 'Prelude'
, P.lcm
-- | Reexport from 'Prelude'
, P.realToFrac
-- | Reexport from 'Prelude'
, P.subtract
, greatestCommonDenominator
, isEven
, isOdd
, leastCommonMultiple
) where
import safe Antelude.Internal.TypesClasses ( Bool, Integral )
import safe qualified Prelude as P
( Double
, Float
, Floating (..)
, Fractional (..)
, Int
, Integer
, Integral (..)
, Num (..)
, Rational
, even
, fromIntegral
, gcd
, lcm
, odd
, realToFrac
, subtract
)
-- | Test if the 'Integral' number is even.
isEven :: (Integral a) => a -> Bool
isEven = P.even
-- | Test if the 'Integral' number is odd.
isOdd :: (Integral a) => a -> Bool
isOdd = P.odd
-- | Defined as 'gcd', get the greatest common denominator of two 'Integral' numbers
greatestCommonDenominator :: (Integral a) => a -> a -> a
greatestCommonDenominator = P.gcd
-- | Defined as 'lcm', get the least common multiple of two 'Integral' numbers
leastCommonMultiple :: (Integral a) => a -> a -> a
leastCommonMultiple = P.lcm