| License | BSD-3-Clause |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Swarm.Game.Step.Arithmetic
Description
Arithmetic and Comparison commands
Synopsis
- evalCmp :: Has (Throw Exn) sig m => Const -> Value -> Value -> m Bool
- compareValues :: Has (Throw Exn) sig m => Value -> Value -> m Ordering
- incompatCmp :: Has (Throw Exn) sig m => Value -> Value -> m a
- incomparable :: Has (Throw Exn) sig m => Value -> Value -> m a
- evalArith :: Has (Throw Exn) sig m => Const -> Integer -> Integer -> m Integer
- safeDiv :: Has (Throw Exn) sig m => Integer -> Integer -> m Integer
- safeExp :: Has (Throw Exn) sig m => Integer -> Integer -> m Integer
Documentation
evalCmp :: Has (Throw Exn) sig m => Const -> Value -> Value -> m Bool Source #
Evaluate the application of a comparison operator. Returns
Nothing if the application does not make sense.
compareValues :: Has (Throw Exn) sig m => Value -> Value -> m Ordering Source #
Compare two values, returning an Ordering if they can be
compared, or Nothing if they cannot.
incompatCmp :: Has (Throw Exn) sig m => Value -> Value -> m a Source #
Values with different types were compared; this should not be possible since the type system should catch it.
incomparable :: Has (Throw Exn) sig m => Value -> Value -> m a Source #
Values were compared of a type which cannot be compared (e.g. functions, etc.).
evalArith :: Has (Throw Exn) sig m => Const -> Integer -> Integer -> m Integer Source #
Evaluate the application of an arithmetic operator, returning
an exception in the case of a failing operation, or in case we
incorrectly use it on a bad Const in the library.