Safe Haskell | Safe-Inferred |
---|
- type Predicate a f t = a -> Result f t
- constant :: t -> Predicate a f t
- failure :: f -> Predicate a f t
- true :: Predicate a f ()
- false :: Predicate a () t
- and :: Predicate a f t -> Predicate a f t' -> Predicate a f (t ::: t')
- or :: Predicate a f t -> Predicate a f t -> Predicate a f t
- orElse :: Predicate a f t -> Predicate a f t' -> Predicate a f (Either t t')
- (.&.) :: Predicate a f t -> Predicate a f t' -> Predicate a f (t ::: t')
- (.|.) :: Predicate a f t -> Predicate a f t -> Predicate a f t
- (|||) :: Predicate a f t -> Predicate a f t' -> Predicate a f (Either t t')
- opt :: Predicate a f t -> Predicate a f (Maybe t)
- def :: t -> Predicate a f t -> Predicate a f t
- mapOkay :: (t -> Result f t') -> Predicate a f t -> Predicate a f t'
- mapFail :: (f -> Result f' t) -> Predicate a f t -> Predicate a f' t
- exec :: Predicate a f t -> a -> (f -> b) -> (t -> b) -> b
- data Result f t
- result :: (f -> a) -> (Double -> t -> a) -> Result f t -> a
- fromEither :: Either f t -> Result f t
- toEither :: Result f t -> Either f t
- newtype ResultT f m t = ResultT {
- runResultT :: m (Result f t)
- resultT :: Monad m => (f -> m a) -> (Double -> t -> m a) -> ResultT f m t -> m a
- resultT' :: Monad m => (f -> m a) -> (t -> m a) -> ResultT f m t -> m a
- mapResultT :: (m (Result f t) -> n (Result f' t')) -> ResultT f m t -> ResultT f' n t'
- hoistResult :: Monad m => Result f t -> ResultT f m t
- okay :: Monad m => Double -> t -> ResultT f m t
- throwF :: Monad m => f -> ResultT f m t
- data a ::: b = a ::: b
- (#) :: a -> (a -> b) -> b
- hd :: (a ::: b) -> a
- tl :: (a ::: b) -> b
- _1 :: (a ::: b) -> a
- _2 :: (a ::: (b ::: c)) -> b
- _3 :: (a ::: (b ::: (c ::: d))) -> c
- _4 :: (a ::: (b ::: (c ::: (d ::: e)))) -> d
- _5 :: (a ::: (b ::: (c ::: (d ::: (e ::: f))))) -> e
- _6 :: (a ::: (b ::: (c ::: (d ::: (e ::: (f ::: g)))))) -> f
- _7 :: (a ::: (b ::: (c ::: (d ::: (e ::: (f ::: (g ::: h))))))) -> g
- _8 :: (a ::: (b ::: (c ::: (d ::: (e ::: (f ::: (g ::: (h ::: i)))))))) -> h
- _9 :: (a ::: (b ::: (c ::: (d ::: (e ::: (f ::: (g ::: (h ::: (i ::: j))))))))) -> i
- _1' :: (a ::: b) -> a
- _2' :: (a ::: b) -> b
- _3' :: (a ::: (b ::: c)) -> c
- _4' :: (a ::: (b ::: (c ::: d))) -> d
- _5' :: (a ::: (b ::: (c ::: (d ::: e)))) -> e
- _6' :: (a ::: (b ::: (c ::: (d ::: (e ::: f))))) -> f
- _7' :: (a ::: (b ::: (c ::: (d ::: (e ::: (f ::: g)))))) -> g
- _8' :: (a ::: (b ::: (c ::: (d ::: (e ::: (f ::: (g ::: h))))))) -> h
- _9' :: (a ::: (b ::: (c ::: (d ::: (e ::: (f ::: (g ::: (h ::: i)))))))) -> i
Predicate
constant :: t -> Predicate a f tSource
A predicate which always returns Okay
with the given
value as metadata.
failure :: f -> Predicate a f tSource
A predicate which always returns Fail
with the given
value as metadata.
and :: Predicate a f t -> Predicate a f t' -> Predicate a f (t ::: t')Source
A predicate corresponding to the logical AND connective of two predicate.
or :: Predicate a f t -> Predicate a f t -> Predicate a f tSource
A predicate corresponding to the logical
OR connective of two predicates. It requires the
metadata of each Okay
branch to be of the same type.
If both arguments evaluate to Okay
the one with the
smaller "delta" will be preferred, or--if equal--the
left-hand argument.
orElse :: Predicate a f t -> Predicate a f t' -> Predicate a f (Either t t')Source
A predicate corresponding to the logical
OR connective of two predicates. The metadata of
each Okay
branch can be of different types.
If both arguments evaluate to Okay
the one with the
smaller "delta" will be preferred, or--if equal--the
left-hand argument.
def :: t -> Predicate a f t -> Predicate a f tSource
A predicate modifier which returns as Okay
metadata the provided default
value if the given predicate fails.
mapOkay :: (t -> Result f t') -> Predicate a f t -> Predicate a f t'Source
Like fmap
, but only maps the Okay
metadata to another result.
mapFail :: (f -> Result f' t) -> Predicate a f t -> Predicate a f' tSource
Like mapOkay
, but for the Fail
case.
Result
A Bool
-like type where each branch--Fail
and Okay
--carries
some metadata.
fromEither :: Either f t -> Result f tSource
ResultT | |
|
hoistResult :: Monad m => Result f t -> ResultT f m tSource
Product
A data-type for combining results of predicate evaluations.
a ::: b |