Safe Haskell  SafeInferred 

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.
Documentation
class Num e => IntegralExp e where Source #
A twist on the Integral
type class that is more friendly to
symbolic representations.
sgn :: e > Maybe Int Source #
Like div
, but rounds towards
positive infinity.
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 # divUp :: Wrapped a > Wrapped a > Wrapped a Source # fromInt8 :: Int8 > Wrapped a Source # fromInt16 :: Int16 > Wrapped a Source # 