Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ivory.Language.Cast
Description
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 -> to Source
Cast with a default value if the casted value is too large.
castDefault :: (Default to, RuntimeCast from to) => from -> to Source
`CastWith 0` for types for which 0 is defined.
class (IvoryExpr from, IvoryExpr to) => SafeCast from to where Source
Statically safe casts.
Minimal complete definition
Nothing
Instances
class (IvoryExpr from, IvoryExpr to, Default to) => RuntimeCast from to Source
Casts requiring runtime checks.
Minimal complete definition
inBounds
Instances
(Bounded from, Bounded to, IvoryOrd from, IvoryOrd to, IvoryExpr from, IvoryExpr to, Default from, Default to, SafeCast to from) => RuntimeCast from to Source | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IDouble) => RuntimeCast IDouble to Source | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IFloat) => RuntimeCast IFloat to Source | Casting from a floating to a |
Default values for expression types.
Minimal complete definition
defaultVal