numhask-0.0.1: A numeric prelude

Safe HaskellNone
LanguageHaskell2010

NumHask.Algebra.Integral

Contents

Description

Integral domains

Synopsis

Integral

class Ring a => Integral a where Source #

Integral

b == zero || b * (a `div` b) + (a `mod` b) == a

Minimal complete definition

divMod

Methods

div :: a -> a -> a infixl 7 Source #

truncates towards negative infinity

mod :: a -> a -> a infixl 7 Source #

divMod :: a -> a -> (a, a) Source #

Instances

Integral Int Source # 

Methods

div :: Int -> Int -> Int Source #

mod :: Int -> Int -> Int Source #

divMod :: Int -> Int -> (Int, Int) Source #

Integral Integer Source # 
(Representable r, Integral a) => Integral (r a) Source # 

Methods

div :: r a -> r a -> r a Source #

mod :: r a -> r a -> r a Source #

divMod :: r a -> r a -> (r a, r a) Source #

class Integral a => ToInteger a where Source #

toInteger and fromInteger as per the base Num instance is problematic for numbers with a Basis

Minimal complete definition

toInteger

Methods

toInteger :: a -> Integer Source #

fromIntegral :: (ToInteger a, FromInteger b) => a -> b Source #

This splitting away of fromInteger from the Ring instance tends to increase constraint boier-plate