ivory- Safe embedded C programming.

Safe HaskellNone




class (IvoryExpr a, IvoryOrd a, Num a) => IvoryIntegral a where Source #

Integral, without the baggage from Haskell (i.e., supertypes of Real and Enum). Defines Euclidian division (rather than truncated division). See http://citeseerx.ist.psu.edu/viewdoc/summary?doi= Notable properties, beyond the normal div/rem properties, are that

The remainder is always non-negative. For d1 < 0, d0 iDiv (-d1) == -(d0 iDiv d1). For d1 < 0, d0 .% (-d1) == d0 .% d1.

N.B. mod and rem are equal if both args are positive, and C has no mod operator (only rem). In Haskell and C, both mod and rem may return negative values. Furthermore, before C99, the result of rem is implementation-defined.


iDiv :: a -> a -> a Source #

Euclidean division.

(.%) :: a -> a -> a Source #

Euclidean remainder.

(./) :: IvoryIntegral a => a -> a -> a Source #

iRem :: IvoryIntegral a => a -> a -> a Source #