Safe Haskell | None |
---|
Safe casting. We assume Floats have 32 bits and Doubles have 64.
- ivoryCast :: forall a b. (IvoryExpr a, IvoryExpr b) => a -> b
- castWith :: RuntimeCast from to => to -> from -> to
- castDefault :: (Default to, RuntimeCast from to) => from -> to
- class (IvoryExpr from, IvoryExpr to) => SafeCast from to where
- safeCast :: from -> to
- class (IvoryExpr from, IvoryExpr to, Default to) => RuntimeCast from to
- class Default a
- class (IvoryExpr from, IvoryExpr to) => SignCast from to where
- signCast :: from -> to
- toMaxSize :: Type -> Maybe Integer
- toMinSize :: Type -> Maybe Integer
Documentation
castWith :: RuntimeCast from to => to -> from -> toSource
Cast with a default value if the casted value is too large.
castDefault :: (Default to, RuntimeCast from to) => from -> toSource
`CastWith 0` for types for which 0 is defined.
class (IvoryExpr from, IvoryExpr to) => SafeCast from to whereSource
Statically safe casts.
class (IvoryExpr from, IvoryExpr to, Default to) => RuntimeCast from to Source
Casts requiring runtime checks.
(Bounded from, Bounded to, IvoryOrd from, IvoryOrd to, IvoryExpr from, IvoryExpr to, Default from, Default to, SafeCast to from) => RuntimeCast from to | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IDouble) => RuntimeCast IDouble to | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IFloat) => RuntimeCast IFloat to | Casting from a floating to a |
Default values for expression types.