mod package:ihaskell
integer modulus, satisfying
(x `div` y)*y + (x `mod` y) == x
WARNING: This function is partial (because it throws when 0 is passed
as the divisor) for all the integer types in
base.
Used to implement
mod for the
Integral typeclass. This
performs the modulo operation, satisfying
((x `div` y) * y) + (x `mod` y) == x
Example
>>> 7 `modInt` 3
1
>>> 7 `mod` 3
1
A slight variation on
modifyMVar_ that allows a value to be
returned (
b) in addition to the modified value of the
MVar.
An exception-safe wrapper for modifying the contents of an
MVar. Like
withMVar,
modifyMVar will replace the
original contents of the
MVar if an exception is raised during
the operation. This function is only atomic if there are no other
producers for this
MVar. In other words, it cannot guarantee
that, by the time
modifyMVar_ gets the chance to write to the
MVar, the value of the MVar has not been altered by a write operation
from another thread.
A full Haskell module, to be compiled and loaded.
Target module for this widget. Evaluates to an empty string by
default.
Load and unload modules via ':module'.
Parse a module and return the name declared in the 'module X where'
line. That line is required, and if it does not exist, this will
error. Names with periods in them are returned piece by piece.
Modify the contents of a
MutVar#, returning the previous
contents and the result of applying the given function to the previous
contents. Note that this isn't strictly speaking the correct type for
this function; it should really be
MutVar# s a -> (a
-> (a,b)) -> State# s -> (# State# s, a, (a, b)
#), but we don't know about pairs here.
Warning: this can fail with an unchecked exception.
Modify the contents of a
MutVar#, returning the previous
contents and the result of applying the given function to the previous
contents.
Warning: this can fail with an unchecked exception.
simultaneous
div and
mod
WARNING: This function is partial (because it throws when 0 is passed
as the divisor) for all the integer types in
base.
Used to implement
divMod for the
Integral typeclass.
This gives a tuple equivalent to
(div x y, mod x y)
Example
>>> divModInt 10 2
(5,0)
>>> divMod 10 2
(5,0)
Simultaneous
integerDiv and
integerMod.
Divisor must be non-zero otherwise the GHC runtime will terminate with
a division-by-zero fault.