| Copyright | (c) Sirui Lu 2024 |
|---|---|
| License | BSD-3-Clause (see the LICENSE file) |
| Maintainer | siruilu@cs.washington.edu |
| Stability | Experimental |
| Portability | GHC only |
| Safe Haskell | None |
| Language | Haskell2010 |
Grisette.Internal.Core.Data.Class.SafeLogBase
Description
Synopsis
- class (MonadError e m, TryMerge m, Mergeable a) => SafeLogBase e a (m :: Type -> Type) where
- safeLogBase :: a -> a -> m a
- class LogBaseOr a where
- logBaseOr :: a -> a -> a -> a
- logBaseOrZero :: (LogBaseOr a, Num a) => a -> a -> a
Documentation
class (MonadError e m, TryMerge m, Mergeable a) => SafeLogBase e a (m :: Type -> Type) where Source #
Safe logBase with monadic error handling in multi-path execution.
These procedures throw an exception when the base is 1.
The result should be able to handle errors with MonadError.
Minimal complete definition
Nothing
Methods
safeLogBase :: a -> a -> m a Source #
Safe logBase with monadic error handling in multi-path execution.
>>>safeLogBase (ssym "base") (ssym "val") :: ExceptT ArithException Union SymAlgRealExceptT {If (= base 1.0) (Left Ratio has zero denominator) (Right (fdiv (log val) (log base)))}
Instances
| (MonadError ArithException m, MonadUnion m) => SafeLogBase ArithException SymAlgReal m Source # | |
Defined in Grisette.Internal.Core.Data.Class.SafeLogBase Methods safeLogBase :: SymAlgReal -> SymAlgReal -> m SymAlgReal Source # | |
| SafeLogBase e a m => SafeLogBase e (AsKey a) m Source # | |
class LogBaseOr a where Source #
Safe logBase with default values returned on exception.
Methods
logBaseOr :: a -> a -> a -> a Source #
Safe logBase with default values returned on exception.
>>>logBaseOr "d" "base" "val" :: SymAlgReal(ite (= base 1.0) d (fdiv (log val) (log base)))
Instances
| LogBaseOr SymAlgReal Source # | |
Defined in Grisette.Internal.Core.Data.Class.SafeLogBase Methods logBaseOr :: SymAlgReal -> SymAlgReal -> SymAlgReal -> SymAlgReal Source # | |
| LogBaseOr a => LogBaseOr (AsKey a) Source # | |