Integral -package:aeson-optics -package:ghc -package:text-show -package:hedgehog -package:Cabal-syntax
Integral numbers, supporting integer division.
The Haskell Report defines no laws for
Integral. However,
Integral instances are customarily expected to define a
Euclidean domain and have the following properties for the
div/
mod and
quot/
rem pairs, given suitable
Euclidean functions
f and
g:
- x = y * quot x y + rem x y with rem x y
= fromInteger 0 or g (rem x y) < g
y
- x = y * div x y + mod x y with mod x y
= fromInteger 0 or f (mod x y) < f
y
An example of a suitable Euclidean function, for
Integer's
instance, is
abs.
In addition,
toInteger should be total, and
fromInteger should be a left inverse for it, i.e.
fromInteger (toInteger i) = i.
amazonka-core Amazonka.Prelude,
rio RIO.Prelude.Types,
base-prelude BasePrelude,
classy-prelude ClassyPrelude,
ihaskell IHaskellPrelude,
github GitHub.Internal.Prelude,
clash-prelude Clash.HaskellPrelude,
linear-base Prelude.Linear,
incipit-base Incipit.Base,
loc Data.Loc.Internal.Prelude,
yesod-paginator Yesod.Paginator.Prelude,
distribution-opensuse OpenSuse.Prelude,
termonad Termonad.Prelude Integral numbers, supporting integer division.
The Haskell Report defines no laws for
Integral. However,
Integral instances are customarily expected to define a
Euclidean domain and have the following properties for the
div/
mod and
quot/
rem pairs, given suitable
Euclidean functions
f and
g:
- x = y * quot x y + rem x y with rem x y
= fromInteger 0 or g (rem x y) < g
y
- x = y * div x y + mod x y with mod x y
= fromInteger 0 or f (mod x y) < f
y
An example of a suitable Euclidean function, for
Integer's
instance, is
abs.
base-compat Prelude.Compat,
relude Relude.Numeric,
universum Universum.Base,
ghc-lib-parser GHC.Prelude.Basic,
dimensional Numeric.Units.Dimensional.Prelude,
rebase Rebase.Prelude,
copilot-language Copilot.Language.Prelude,
LambdaHack Game.LambdaHack.Core.Prelude,
cabal-install-solver Distribution.Solver.Compat.Prelude,
faktory Faktory.Prelude,
hledger-web Hledger.Web.Import,
verset Verset Integral numbers, supporting integer division.
The Haskell Report defines no laws for
Integral. However,
Integral instances are customarily expected to define a
Euclidean domain and have the following properties for the
div/
mod and
quot/
rem pairs, given suitable
Euclidean functions
f and
g:
- x = y * quot x y + rem x y with rem x y
= fromInteger 0 or g (rem x y) < g
y
- x = y * div x y + mod x y with mod x y
= fromInteger 0 or f (mod x y) < f
y
An example of a suitable Euclidean function, for
Integer's
instance, is
abs.
In addition,
toInteger should be total, and
fromInteger
should be a left inverse for it, i.e.
fromInteger (toInteger i) =
i.
Pattern synonym that can be used to construct or pattern match on an
Integer as if it were of any
Integral type.
Functions for parsing and producing
Integral values from/to
ByteStrings based on the "Char8" encoding. That is, we assume
an ASCII-compatible encoding of alphanumeric characters.
Since: 0.3.0
Integral numbers, supporting integer division.
Integral Literal support
e.g. 123 :: Integer 123 :: Word8
An Integral is anything that satisfies the law:
\a b -> b == zero || b * (a `div` b) + (a `mod` b) == a
>>> 3 `divMod` 2
(1,1)
>>> (-3) `divMod` 2
(-2,1)
>>> (-3) `quotRem` 2
(-1,-1)
Integral numbers, supporting integer division.
The Haskell Report defines no laws for
Integral. However,
Integral instances are customarily expected to define a
Euclidean domain and have the following properties for the 'div'/'mod'
and 'quot'/'rem' pairs, given suitable Euclidean functions
f
and
g:
- x = y * quot x y + rem x y with rem x y
= fromInteger 0 or g (rem x y) < g
y
- x = y * div x y + mod x y with mod x y
= fromInteger 0 or f (mod x y) < f
y
An example of a suitable Euclidean function, for
Integer's
instance, is
abs.
Parsers for integral numbers written in positional numeral systems.
Print integral numbers in common positional numeral systems.
Integral class operators applied point-wise on streams.
Safe overrides of the methods of class
Integral.
This
Prism can be used to model the fact that every
Integral type is a subset of
Integer.
Embedding through the
Prism only succeeds if the
Integer
would pass through unmodified when re-extracted.
Integration using the rectangle rule.
Constructor for a simple integral type.