collect-errors-0.1.5.0: Error monad with a Float instance
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.CollectErrors.Type

Synopsis

Documentation

data CollectErrors es v Source #

A wrapper around values which can accommodate a list of (potential) errors that have (maybe) occurred during the computation of a value. A value may be missing, leaving only the error(s).

Such error collection allows one to write expressions with partial functions (ie functions that fail for some inputs) instead of branching after each application of such function. Dealing with the errors can be moved outside the expression. If the error data contain enough information, their list can be used to trace the source of the errors.

Constructors

CollectErrors 

Fields

Instances

Instances details
Monoid es => CanTakeErrors es (CollectErrors es t) Source # 
Instance details

Defined in Control.CollectErrors.Type

(Floating v, Ord v, Show v) => Floating (CN v) Source # 
Instance details

Defined in Numeric.CollectErrors.PreludeInstances

Methods

pi :: CN v #

exp :: CN v -> CN v #

log :: CN v -> CN v #

sqrt :: CN v -> CN v #

(**) :: CN v -> CN v -> CN v #

logBase :: CN v -> CN v -> CN v #

sin :: CN v -> CN v #

cos :: CN v -> CN v #

tan :: CN v -> CN v #

asin :: CN v -> CN v #

acos :: CN v -> CN v #

atan :: CN v -> CN v #

sinh :: CN v -> CN v #

cosh :: CN v -> CN v #

tanh :: CN v -> CN v #

asinh :: CN v -> CN v #

acosh :: CN v -> CN v #

atanh :: CN v -> CN v #

log1p :: CN v -> CN v #

expm1 :: CN v -> CN v #

log1pexp :: CN v -> CN v #

log1mexp :: CN v -> CN v #

(Fractional v, Eq v) => Fractional (CN v) Source # 
Instance details

Defined in Numeric.CollectErrors.PreludeInstances

Methods

(/) :: CN v -> CN v -> CN v #

recip :: CN v -> CN v #

fromRational :: Rational -> CN v #

(Integral v, Ord v, Show v) => Integral (CN v) Source # 
Instance details

Defined in Numeric.CollectErrors.PreludeInstances

Methods

quot :: CN v -> CN v -> CN v #

rem :: CN v -> CN v -> CN v #

div :: CN v -> CN v -> CN v #

mod :: CN v -> CN v -> CN v #

quotRem :: CN v -> CN v -> (CN v, CN v) #

divMod :: CN v -> CN v -> (CN v, CN v) #

toInteger :: CN v -> Integer #

Monoid es => Monad (CollectErrors es) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

(>>=) :: CollectErrors es a -> (a -> CollectErrors es b) -> CollectErrors es b #

(>>) :: CollectErrors es a -> CollectErrors es b -> CollectErrors es b #

return :: a -> CollectErrors es a #

Functor (CollectErrors es) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

fmap :: (a -> b) -> CollectErrors es a -> CollectErrors es b #

(<$) :: a -> CollectErrors es b -> CollectErrors es a #

Monoid es => Applicative (CollectErrors es) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

pure :: a -> CollectErrors es a #

(<*>) :: CollectErrors es (a -> b) -> CollectErrors es a -> CollectErrors es b #

liftA2 :: (a -> b -> c) -> CollectErrors es a -> CollectErrors es b -> CollectErrors es c #

(*>) :: CollectErrors es a -> CollectErrors es b -> CollectErrors es b #

(<*) :: CollectErrors es a -> CollectErrors es b -> CollectErrors es a #

NFData es => NFData1 (CollectErrors es) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

liftRnf :: (a -> ()) -> CollectErrors es a -> () #

CanClearPotentialErrors (CN t) Source # 
Instance details

Defined in Numeric.CollectErrors.Type

Methods

clearPotentialErrors :: CN t -> CN t Source #

Generic1 (CollectErrors es :: Type -> Type) Source # 
Instance details

Defined in Control.CollectErrors.Type

Associated Types

type Rep1 (CollectErrors es) :: k -> Type #

Methods

from1 :: forall (a :: k). CollectErrors es a -> Rep1 (CollectErrors es) a #

to1 :: forall (a :: k). Rep1 (CollectErrors es) a -> CollectErrors es a #

(CanBeErrors es, Bounded v) => Bounded (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.PreludeInstances

(CanBeErrors es, Enum v) => Enum (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.PreludeInstances

(CanBeErrors es, Eq v) => Eq (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.PreludeInstances

Methods

(==) :: CollectErrors es v -> CollectErrors es v -> Bool #

(/=) :: CollectErrors es v -> CollectErrors es v -> Bool #

(CanBeErrors es, Num v) => Num (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.PreludeInstances

(CanBeErrors es, Ord v) => Ord (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.PreludeInstances

Methods

compare :: CollectErrors es v -> CollectErrors es v -> Ordering #

(<) :: CollectErrors es v -> CollectErrors es v -> Bool #

(<=) :: CollectErrors es v -> CollectErrors es v -> Bool #

(>) :: CollectErrors es v -> CollectErrors es v -> Bool #

(>=) :: CollectErrors es v -> CollectErrors es v -> Bool #

max :: CollectErrors es v -> CollectErrors es v -> CollectErrors es v #

min :: CollectErrors es v -> CollectErrors es v -> CollectErrors es v #

(CanBeErrors es, Real v) => Real (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.PreludeInstances

(Show v, CanBeErrors es) => Show (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

showsPrec :: Int -> CollectErrors es v -> ShowS #

show :: CollectErrors es v -> String #

showList :: [CollectErrors es v] -> ShowS #

Generic (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.Type

Associated Types

type Rep (CollectErrors es v) :: Type -> Type #

Methods

from :: CollectErrors es v -> Rep (CollectErrors es v) x #

to :: Rep (CollectErrors es v) x -> CollectErrors es v #

(Arbitrary t, Monoid es) => Arbitrary (CollectErrors es t) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

arbitrary :: Gen (CollectErrors es t) #

shrink :: CollectErrors es t -> [CollectErrors es t] #

(NFData v, NFData es) => NFData (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

rnf :: CollectErrors es v -> () #

CanTestErrorsPresent es => CanTestErrorsPresent (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

hasError :: CollectErrors es v -> Bool Source #

CanTestErrorsCertain es => CanTestErrorsCertain (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.Type

type Rep1 (CollectErrors es :: Type -> Type) Source # 
Instance details

Defined in Control.CollectErrors.Type

type Rep1 (CollectErrors es :: Type -> Type) = D1 ('MetaData "CollectErrors" "Control.CollectErrors.Type" "collect-errors-0.1.5.0-DAyNZ8BMV4w4yqJNdU6hiq" 'False) (C1 ('MetaCons "CollectErrors" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMaybeValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 Maybe) :*: S1 ('MetaSel ('Just "getErrors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 es)))
type Rep (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.Type

type Rep (CollectErrors es v) = D1 ('MetaData "CollectErrors" "Control.CollectErrors.Type" "collect-errors-0.1.5.0-DAyNZ8BMV4w4yqJNdU6hiq" 'False) (C1 ('MetaCons "CollectErrors" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMaybeValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe v)) :*: S1 ('MetaSel ('Just "getErrors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 es)))

class CanTestErrorsPresent es where Source #

Methods

hasError :: es -> Bool Source #

Instances

Instances details
CanTestErrorsPresent NumErrors Source # 
Instance details

Defined in Numeric.CollectErrors.Type

CanTestErrorsPresent [es] Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

hasError :: [es] -> Bool Source #

CanTestErrorsPresent (Set es) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

hasError :: Set es -> Bool Source #

CanTestErrorsPresent es => CanTestErrorsPresent (CollectErrors es v) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

hasError :: CollectErrors es v -> Bool Source #

removeValue :: Monoid es => CollectErrors es v -> es -> CollectErrors es v Source #

Take a CE-value, add new errors into it and remove the value, if any

unCollectErrors :: Show es => CollectErrors es p -> p Source #

Unsafe way to get a value out of the CollectErrors wrapper.

(~!) :: Show es => CollectErrors es p -> p Source #

Unsafe way to get a value out of the CollectErrors wrapper.

toEither :: CanBeErrors es => CollectErrors es v -> Either es v Source #

A safe way to get a value out of the CollectErrors wrapper.

withErrorOrValue :: CanBeErrors es => (es -> t) -> (v -> t) -> CollectErrors es v -> t Source #

lift :: Monoid es => (a -> b) -> CollectErrors es a -> CollectErrors es b Source #

liftCE :: Monoid es => (a -> CollectErrors es c) -> CollectErrors es a -> CollectErrors es c Source #

liftPair :: Monoid es => (a -> (c, d)) -> CollectErrors es a -> (CollectErrors es c, CollectErrors es d) Source #

lift2 :: Monoid es => (a -> b -> c) -> CollectErrors es a -> CollectErrors es b -> CollectErrors es c Source #

lift2CE :: Monoid es => (a -> b -> CollectErrors es c) -> CollectErrors es a -> CollectErrors es b -> CollectErrors es c Source #

lift1T :: Monoid es => (a -> b -> c) -> CollectErrors es a -> b -> CollectErrors es c Source #

lift1TCE :: Monoid es => (a -> b -> CollectErrors es c) -> CollectErrors es a -> b -> CollectErrors es c Source #

liftT1 :: Monoid es => (a -> b -> c) -> a -> CollectErrors es b -> CollectErrors es c Source #

liftT1CE :: Monoid es => (a -> b -> CollectErrors es c) -> a -> CollectErrors es b -> CollectErrors es c Source #

lift2pair :: Monoid es => (a -> b -> (c, d)) -> CollectErrors es a -> CollectErrors es b -> (CollectErrors es c, CollectErrors es d) Source #

lift1Tpair :: Monoid es => (a -> b -> (c, d)) -> CollectErrors es a -> b -> (CollectErrors es c, CollectErrors es d) Source #

liftT1pair :: Monoid es => (a -> b -> (c, d)) -> a -> CollectErrors es b -> (CollectErrors es c, CollectErrors es d) Source #

liftTakeErrors :: CanTakeErrors es t2 => (t1 -> t2) -> CollectErrors es t1 -> t2 Source #

class CanTakeErrors es t where Source #

Methods

takeErrors :: es -> t -> t Source #

takeErrorsNoValue :: es -> t Source #

Instances

Instances details
(CanTakeErrors es t1, CanTakeErrors es t2) => CanTakeErrors es (t1, t2) Source # 
Instance details

Defined in Control.CollectErrors.Type

Methods

takeErrors :: es -> (t1, t2) -> (t1, t2) Source #

takeErrorsNoValue :: es -> (t1, t2) Source #

Monoid es => CanTakeErrors es (CollectErrors es t) Source # 
Instance details

Defined in Control.CollectErrors.Type