| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Grisette.Core.Data.Class.SafeSymShift
Synopsis
- class SymShift a => SafeSymShift e a | a -> e where
- safeSymShiftL :: (MonadError e m, UnionLike m) => a -> a -> m a
- safeSymShiftR :: (MonadError e m, UnionLike m) => a -> a -> m a
- safeSymShiftL' :: (MonadError e' m, UnionLike m) => (e -> e') -> a -> a -> m a
- safeSymShiftR' :: (MonadError e' m, UnionLike m) => (e -> e') -> a -> a -> m a
- safeSymStrictShiftL :: (MonadError e m, UnionLike m) => a -> a -> m a
- safeSymStrictShiftR :: (MonadError e m, UnionLike m) => a -> a -> m a
- safeSymStrictShiftL' :: (MonadError e' m, UnionLike m) => (e -> e') -> a -> a -> m a
- safeSymStrictShiftR' :: (MonadError e' m, UnionLike m) => (e -> e') -> a -> a -> m a
Documentation
class SymShift a => SafeSymShift e a | a -> e where Source #
Safe version for shiftL or shiftR.
The safeSymShiftL and safeSymShiftR and their primed versions are defined
for all non-negative shift amounts.
- Shifting by negative shift amounts is an error.
- The result is defined to be 0 when shifting left by more than or equal to the bit size of the number.
- The result is defined to be 0 when shifting right by more than or equal to the bit size of the number and the number is unsigned or signed non-negative.
- The result is defined to be -1 when shifting right by more than or equal to the bit size of the number and the number is signed negative.
The safeSymStrictShiftL and safeSymStrictShiftR and their primed versions
are defined for all non-negative shift amounts that is less than the bit
size. Shifting by more than or equal to the bit size is an error, otherwise
they are the same as the non-strict versions.
Minimal complete definition
safeSymShiftL', safeSymShiftR', safeSymStrictShiftL', safeSymStrictShiftR'
Methods
safeSymShiftL :: (MonadError e m, UnionLike m) => a -> a -> m a Source #
safeSymShiftR :: (MonadError e m, UnionLike m) => a -> a -> m a Source #
safeSymShiftL' :: (MonadError e' m, UnionLike m) => (e -> e') -> a -> a -> m a Source #
safeSymShiftR' :: (MonadError e' m, UnionLike m) => (e -> e') -> a -> a -> m a Source #
safeSymStrictShiftL :: (MonadError e m, UnionLike m) => a -> a -> m a Source #
safeSymStrictShiftR :: (MonadError e m, UnionLike m) => a -> a -> m a Source #
safeSymStrictShiftL' :: (MonadError e' m, UnionLike m) => (e -> e') -> a -> a -> m a Source #
safeSymStrictShiftR' :: (MonadError e' m, UnionLike m) => (e -> e') -> a -> a -> m a Source #