mixed-types-num-0.3.1: 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

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.