mixed-types-num-0.3.1.5: Alternative Prelude with numeric and logic expressions typed bottom-up

Copyright(c) Michal Konecny
LicenseBSD3
Maintainermikkonecny@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Numeric.CollectErrors

Contents

Description

A type of numeric errors to be collected.

Synopsis

Type of numeric errors

data NumError Source #

Instances
Eq NumError Source # 
Instance details

Defined in Numeric.CollectErrors

Show NumError Source # 
Instance details

Defined in Numeric.CollectErrors

CanTestErrorsCertain NumErrors Source # 
Instance details

Defined in Numeric.CollectErrors

OrderedCertainlyRing (CN Integer) Source # 
Instance details

Defined in Numeric.MixedTypes.Ring

OrderedCertainlyRing (CN Rational) Source # 
Instance details

Defined in Numeric.MixedTypes.Ring

OrderedRing (CN Integer) Source # 
Instance details

Defined in Numeric.MixedTypes.Ring

OrderedRing (CN Rational) Source # 
Instance details

Defined in Numeric.MixedTypes.Ring

Ring (CN Integer) Source # 
Instance details

Defined in Numeric.MixedTypes.Ring

Ring (CN Rational) Source # 
Instance details

Defined in Numeric.MixedTypes.Ring

OrderedCertainlyField (CN Rational) Source # 
Instance details

Defined in Numeric.MixedTypes.Field

OrderedField (CN Rational) Source # 
Instance details

Defined in Numeric.MixedTypes.Field

Field (CN Rational) Source # 
Instance details

Defined in Numeric.MixedTypes.Field

Specialisation to numeric errors

noValueNumErrorCertainCN :: NumError -> CN v Source #

Construct an empty wrapper indicating that given error has certainly occurred.

noValueNumErrorPotentialCN :: NumError -> CN v Source #

Construct an empty wrapper indicating that given error may have occurred.

ensureCN :: CanEnsureCN v => v -> EnsureCN v Source #

Translate a value of a type a to a value of a type CollectNumErrors a except when a already is a CollectNumErrors type, in which case the value is left as is.

deEnsureCN :: CanEnsureCN v => EnsureCN v -> Either NumErrors v Source #

Translate a value of a type EnsureCN es a to a, throwing an exception if there was an error. If a is a CollectNumErrors type, then this is just an identity.

ensureNoCN :: CanEnsureCN v => v -> (Maybe (EnsureNoCN v), NumErrors) Source #

Translate a value of a type a to a value of a type CollectNumErrors a except when a already is a CollectNumErrors type, in which case the value is left as is.

noValueNumErrorCertainECN :: CanEnsureCN v => Maybe v -> NumError -> EnsureCN v Source #

Construct an empty wrapper indicating that given error has certainly occurred.

noValueNumErrorPotentialECN :: CanEnsureCN v => Maybe v -> NumError -> EnsureCN v Source #

Construct an empty wrapper indicating that given error may have occurred.

extractCN :: (CanEnsureCN c, CanExtractCN f) => f c -> CN (f (EnsureNoCN c)) Source #

More compact synonyms

cn :: CanEnsureCN v => v -> EnsureCN v Source #

Wrap a value in the CollectNumErrors wrapper.

deCN :: CanEnsureCN v => EnsureCN v -> Either NumErrors v Source #

An unsafe way to get a value out of the CollectNumErrors wrapper.

(~!) :: (CanEnsureCN v, Show v) => v -> EnsureNoCN v Source #

An unsafe way to get a value out of the CollectNumErrors wrapper.