servant-0.14: A family of combinators for defining webservices APIs

Safe HaskellSafe
LanguageHaskell2010

Servant.API.Alternative

Synopsis

Documentation

data a :<|> b infixr 3 Source #

Union of two APIs, first takes precedence in case of overlap.

Example:

>>> :{
type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
       :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] () -- POST /books
:}

Constructors

a :<|> b infixr 3 

Instances

Functor ((:<|>) a) Source # 

Methods

fmap :: (a -> b) -> (a :<|> a) -> a :<|> b #

(<$) :: a -> (a :<|> b) -> a :<|> a #

Foldable ((:<|>) a) Source # 

Methods

fold :: Monoid m => (a :<|> m) -> m #

foldMap :: Monoid m => (a -> m) -> (a :<|> a) -> m #

foldr :: (a -> b -> b) -> b -> (a :<|> a) -> b #

foldr' :: (a -> b -> b) -> b -> (a :<|> a) -> b #

foldl :: (b -> a -> b) -> b -> (a :<|> a) -> b #

foldl' :: (b -> a -> b) -> b -> (a :<|> a) -> b #

foldr1 :: (a -> a -> a) -> (a :<|> a) -> a #

foldl1 :: (a -> a -> a) -> (a :<|> a) -> a #

toList :: (a :<|> a) -> [a] #

null :: (a :<|> a) -> Bool #

length :: (a :<|> a) -> Int #

elem :: Eq a => a -> (a :<|> a) -> Bool #

maximum :: Ord a => (a :<|> a) -> a #

minimum :: Ord a => (a :<|> a) -> a #

sum :: Num a => (a :<|> a) -> a #

product :: Num a => (a :<|> a) -> a #

Traversable ((:<|>) a) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> (a :<|> a) -> f (a :<|> b) #

sequenceA :: Applicative f => (a :<|> f a) -> f (a :<|> a) #

mapM :: Monad m => (a -> m b) -> (a :<|> a) -> m (a :<|> b) #

sequence :: Monad m => (a :<|> m a) -> m (a :<|> a) #

(HasLink * a, HasLink * b) => HasLink * ((:<|>) a b) Source # 

Associated Types

type MkLink (a :<|> b) (endpoint :: a :<|> b) a :: * Source #

Methods

toLink :: (Link -> a) -> Proxy (a :<|> b) endpoint -> Link -> MkLink (a :<|> b) endpoint a Source #

(Bounded b, Bounded a) => Bounded ((:<|>) a b) Source # 

Methods

minBound :: a :<|> b #

maxBound :: a :<|> b #

(Eq b, Eq a) => Eq ((:<|>) a b) Source # 

Methods

(==) :: (a :<|> b) -> (a :<|> b) -> Bool #

(/=) :: (a :<|> b) -> (a :<|> b) -> Bool #

(Show b, Show a) => Show ((:<|>) a b) Source # 

Methods

showsPrec :: Int -> (a :<|> b) -> ShowS #

show :: (a :<|> b) -> String #

showList :: [a :<|> b] -> ShowS #

(Semigroup a, Semigroup b) => Semigroup ((:<|>) a b) Source # 

Methods

(<>) :: (a :<|> b) -> (a :<|> b) -> a :<|> b #

sconcat :: NonEmpty (a :<|> b) -> a :<|> b #

stimes :: Integral b => b -> (a :<|> b) -> a :<|> b #

(Monoid a, Monoid b) => Monoid ((:<|>) a b) Source # 

Methods

mempty :: a :<|> b #

mappend :: (a :<|> b) -> (a :<|> b) -> a :<|> b #

mconcat :: [a :<|> b] -> a :<|> b #

(Enter typ1 m1 n1 ret1, Enter typ2 m2 n2 ret2, (~) (* -> *) m1 m2, (~) (* -> *) n1 n2, (~) * (Entered m1 n1 ((:<|>) typ1 typ2)) ((:<|>) ret1 ret2), (~) * (Entered n1 m1 ((:<|>) ret1 ret2)) ((:<|>) typ1 typ2)) => Enter ((:<|>) typ1 typ2) m1 n1 ((:<|>) ret1 ret2) Source # 

Methods

enter :: (* :~> m1) n1 -> (typ1 :<|> typ2) -> ret1 :<|> ret2 Source #

type MkLink * ((:<|>) a b) r Source # 
type MkLink * ((:<|>) a b) r = (:<|>) (MkLink * a r) (MkLink * b r)