Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ivory.Language.Cast
Description
Safe casting. We assume Floats have 32 bits and Doubles have 64.
Synopsis
- safeCast :: SafeCast from to => from -> to
- 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
- signCast :: SignCast from to => from -> to
- class (IvoryExpr from, IvoryExpr to) => SafeCast from to
- class (IvoryExpr from, IvoryExpr to, Default to) => RuntimeCast from to
- class Default a
- class (IvoryExpr from, IvoryExpr to) => 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 Source #
Statically safe casts.
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 # | |
Defined in Ivory.Language.Cast | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IDouble) => RuntimeCast IDouble to Source # | |
Defined in Ivory.Language.Cast | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IFloat) => RuntimeCast IFloat to Source # | Casting from a floating to a |
Defined in Ivory.Language.Cast |
Default values for expression types.
Minimal complete definition
defaultVal
Instances
Default Sint64 Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: Sint64 | |
Default Sint32 Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: Sint32 | |
Default Sint16 Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: Sint16 | |
Default Sint8 Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: Sint8 | |
Default Uint64 Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: Uint64 | |
Default Uint32 Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: Uint32 | |
Default Uint16 Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: Uint16 | |
Default Uint8 Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: Uint8 | |
Default IDouble Source # | |
Defined in Ivory.Language.Cast Methods | |
Default IFloat Source # | |
Defined in Ivory.Language.Cast Methods defaultVal :: IFloat |
class (IvoryExpr from, IvoryExpr to) => SignCast from to Source #
SignCast takes a unsigned number into its signed form iff safe, otherwise 0, and same with signed into unsigned
Minimal complete definition