grisette-0.11.0.0: Symbolic evaluation as a library
Copyright(c) Sirui Lu 2024
LicenseBSD-3-Clause (see the LICENSE file)
Maintainersiruilu@cs.washington.edu
StabilityExperimental
PortabilityGHC only
Safe HaskellNone
LanguageHaskell2010

Grisette.Internal.Core.Data.Class.SafeLogBase

Description

 
Synopsis

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 SymAlgReal
ExceptT {If (= base 1.0) (Left Ratio has zero denominator) (Right (fdiv (log val) (log base)))}

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

Instances details
LogBaseOr SymAlgReal Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.SafeLogBase

logBaseOrZero :: (LogBaseOr a, Num a) => a -> a -> a Source #

Safe logBase with 0 returned on exception.