Safe Haskell  Safe 

Language  Haskell2010 
It is occasionally useful to define generic functions that can not only compute their result as an integer, but also as a symbolic expression in the form of an AST.
There are some Haskell hacks for this  it is for example not hard
to define an instance of Num
that constructs an AST. However,
this falls down for some other interesting classes, like
Integral
, which requires both the problematic method
fromInteger
, and also that the type is an instance of Enum
.
We can always just define hobbled instances that call error
for
those methods that are impractical, but this is ugly.
Hence, this module defines similes to standard Haskell numeric typeclasses that have been modified to make generic functions slightly easier to write.
Synopsis
 class Num e => IntegralExp e where
 newtype Wrapped a = Wrapped {
 wrappedValue :: a
 quotRoundingUp :: IntegralExp num => num > num > num
Documentation
class Num e => IntegralExp e where Source #
sgn :: e > Maybe Int Source #
fromInt8 :: Int8 > e Source #
fromInt16 :: Int16 > e Source #
Instances
This wrapper allows you to use a type that is an instance of the true class whenever the simile class is required.
Wrapped  

Instances
Eq a => Eq (Wrapped a) Source #  
Num a => Num (Wrapped a) Source #  
Defined in Futhark.Util.IntegralExp  
Ord a => Ord (Wrapped a) Source #  
Defined in Futhark.Util.IntegralExp  
Show a => Show (Wrapped a) Source #  
Integral a => IntegralExp (Wrapped a) Source #  
Defined in Futhark.Util.IntegralExp quot :: Wrapped a > Wrapped a > Wrapped a Source # rem :: Wrapped a > Wrapped a > Wrapped a Source # div :: Wrapped a > Wrapped a > Wrapped a Source # mod :: Wrapped a > Wrapped a > Wrapped a Source # sgn :: Wrapped a > Maybe Int Source # fromInt8 :: Int8 > Wrapped a Source # fromInt16 :: Int16 > Wrapped a Source # 
quotRoundingUp :: IntegralExp num => num > num > num Source #
Like IntegralExp
, but rounds up.