{- |
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 :: forall a. Integral a => a -> Bool
isEven = a -> Bool
forall a. Integral a => a -> Bool
P.even


-- | Test if the 'Integral' number is odd.
isOdd :: (Integral a) => a -> Bool
isOdd :: forall a. Integral a => a -> Bool
isOdd = a -> Bool
forall a. Integral a => a -> Bool
P.odd


-- | Defined as 'gcd', get the greatest common denominator of two 'Integral' numbers
greatestCommonDenominator :: (Integral a) => a -> a -> a
greatestCommonDenominator :: forall a. Integral a => a -> a -> a
greatestCommonDenominator = a -> a -> a
forall a. Integral a => a -> a -> a
P.gcd


-- | Defined as 'lcm', get the least common multiple of two 'Integral' numbers
leastCommonMultiple :: (Integral a) => a -> a -> a
leastCommonMultiple :: forall a. Integral a => a -> a -> a
leastCommonMultiple = a -> a -> a
forall a. Integral a => a -> a -> a
P.lcm