{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
module Web.Eved.Internal
where
import Data.List.NonEmpty (NonEmpty)
import Data.Text (Text)
import Network.HTTP.Types (Status, StdMethod (..), status200)
import Web.Eved.ContentType (ContentType)
import Web.Eved.Header (Header)
import Web.Eved.QueryParam (QueryParam)
import Web.Eved.UrlElement (UrlElement)
data (:<|>) a b = a :<|> b
infixl 4 :<|>
class Eved api m | api -> m where
(.<|>) :: api a -> api b -> api (a :<|> b)
lit :: Text -> api a -> api a
capture :: Text -> UrlElement a -> api b -> api (a -> b)
reqBody :: NonEmpty (ContentType a) -> api b -> api (a -> b)
queryParam :: Text -> QueryParam a -> api b -> api (a -> b)
:: Text -> Header a -> api b -> api (a -> b)
verb :: StdMethod -> Status -> NonEmpty (ContentType a) -> api (m a)