Hoogle Search

Within LTS Haskell 22.21 (ghc-9.6.5)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. orElse :: (Selective f, Semigroup e) => f (Either e a) -> f (Either e a) -> f (Either e a)

    selective Control.Selective

    Return the first Right value. If both are Left's, accumulate errors.

  2. orElse :: Parser x s a -> Parser e s a -> Parser e s a

    bytesmith Data.Bytes.Parser

    There is a law-abiding instance of Alternative for Parser. However, it is not terribly useful since error messages seldom have a Monoid instance. This function is a variant of <|> that is right-biased in its treatment of error messages. Consequently, orElse lacks an identity. See attoparsec issue #122 for more discussion of this topic.

  3. orElse :: (Selective f, Semigroup e) => f (Either e a) -> f (Either e a) -> f (Either e a)

    rebase Rebase.Prelude

    Return the first Right value. If both are Left's, accumulate errors.

  4. orElse :: MonadSTM stm => stm a -> stm a -> stm a

    concurrency Control.Monad.STM.Class

    Run the first transaction and, if it retrys, run the second instead. This is just mplus.

  5. orElse :: Validate v => v e a -> a -> a

    validation Data.Validation

    v orElse a returns a when v is Failure, and the a in Success a. This can be thought of as having the less general type:

    orElse :: Validation e a -> a -> a
    

  6. orElse :: STM a -> STM a -> STM a

    classy-prelude-yesod ClassyPrelude.Yesod

    Compose two alternative STM actions (GHC only). If the first action completes without retrying then it forms the result of the orElse. Otherwise, if the first action retries, then the second action is tried in its place. If both actions retry then the orElse as a whole retries.

  7. orElse :: STM a -> STM a -> STM a

    effectful Effectful.Concurrent.STM

    Compose two alternative STM actions (GHC only). If the first action completes without retrying then it forms the result of the orElse. Otherwise, if the first action retries, then the second action is tried in its place. If both actions retry then the orElse as a whole retries.

  8. orElse :: STM a -> STM a -> STM a

    stack Stack.Prelude

    Compose two alternative STM actions (GHC only). If the first action completes without retrying then it forms the result of the orElse. Otherwise, if the first action retries, then the second action is tried in its place. If both actions retry then the orElse as a whole retries.

  9. orElse :: STM a -> STM a -> STM a

    termonad Termonad.Prelude

    Compose two alternative STM actions (GHC only). If the first action completes without retrying then it forms the result of the orElse. Otherwise, if the first action retries, then the second action is tried in its place. If both actions retry then the orElse as a whole retries.

  10. orElse :: Semigroup e => Validator e inp a -> Validator e inp a -> Validator e inp a

    valida Valida.Combinators

    Build a validator that succeeds if either of the given validators succeed. The first (left-most) Success is returned. If both fail, the errors are combined. Other validator is not used if first one succeeds.

    vald1 `orElse` (vald2 `orElse` vald3) = (vald1 `orElse` vald2) `orElse` vald3
    
    failV e `orElse` vald = vald
    
    vald `orElse` failV e = vald
    

    Examples

    >>> let vald = failureIf (>0) "Positive" `orElse` failureIf even "Even"
    
    >>> runValidator vald 5
    Success 5
    
    >>> runValidator vald 4
    Failure ("Positive" :| ["Even"])
    
    >>> runValidator vald 0
    Success 0
    
    >>> runValidator vald (-1)
    Success (-1)
    

Page 2 of many | Previous | Next