Hoogle Search

Within LTS Haskell 24.2 (ghc-9.10.2)

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

  1. orElse :: Maybe a -> a -> a

    ghc-lib-parser GHC.Data.Maybe

    Flipped version of fromMaybe, useful for chaining.

  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 :: 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.

  5. 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.

  6. 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)
    

  7. orElse :: Semigroup e => ValidationRule e a -> ValidationRule e a -> ValidationRule e a

    valida-base Valida.Combinators

    Build a rule that succeeds if either of the given rules succeed. If both fail, the errors are combined.

    rule1 `orElse` (rule2 `orElse` rule3) = (rule1 `orElse` rule2) `orElse` rule3
    
    falseRule e `orElse` rule = rule
    
    rule `orElse` falseRule e = rule
    

    Examples

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

  8. 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
    

  9. 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.

  10. orElseSTM :: STM a -> STM a -> STM a

    classy-prelude ClassyPrelude

    Synonym for orElse.

Page 2 of many | Previous | Next