packages feed

pipes-fluid-0.3.0.0: src/Pipes/Fluid/Alternative.hs

module Pipes.Fluid.Alternative where

import Control.Applicative

bothOrEither :: Alternative f => f a -> f b -> f (Either (a, b) (Either a b))
bothOrEither left right =
  (curry Left <$> left <*> right)
  <|>
  (Right . Left <$> left)
  <|>
  (Right . Right <$> right)