module Mig.Core.Types.Route (
Body (..),
Query (..),
QueryFlag (..),
Optional (..),
Capture (..),
Header (..),
OptionalHeader (..),
Cookie (..),
PathInfo (..),
FullPathInfo (..),
RawRequest (..),
IsSecure (..),
Send (..),
Get,
Post,
Put,
Delete,
Options,
Head,
Patch,
Trace,
IsMethod (..),
GET,
POST,
PUT,
DELETE,
OPTIONS,
HEAD,
PATCH,
TRACE,
) where
import Control.Monad.IO.Class
import Control.Monad.Trans.Class
import Data.Text (Text)
import GHC.TypeLits
import Network.HTTP.Types.Method
import Mig.Core.Types.Http (Request)
newtype Body media a = Body a
newtype Query (sym :: Symbol) a = Query a
newtype Optional (sym :: Symbol) a = Optional (Maybe a)
newtype QueryFlag (sym :: Symbol) = QueryFlag Bool
newtype Capture (sym :: Symbol) a = Capture a
newtype (sym :: Symbol) a = a
newtype (sym :: Symbol) a = (Maybe a)
newtype Cookie a = Cookie (Maybe a)
newtype PathInfo = PathInfo [Text]
newtype FullPathInfo = FullPathInfo Text
newtype RawRequest = RawRequest Request
newtype IsSecure = IsSecure Bool
newtype Send method m a = Send {forall {k} {k} (method :: k) (m :: k -> *) (a :: k).
Send method m a -> m a
unSend :: m a}
deriving newtype (forall k (method :: k) (m :: * -> *) a b.
Functor m =>
a -> Send method m b -> Send method m a
forall k (method :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Send method m a -> Send method m b
forall a b. a -> Send method m b -> Send method m a
forall a b. (a -> b) -> Send method m a -> Send method m b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Send method m b -> Send method m a
$c<$ :: forall k (method :: k) (m :: * -> *) a b.
Functor m =>
a -> Send method m b -> Send method m a
fmap :: forall a b. (a -> b) -> Send method m a -> Send method m b
$cfmap :: forall k (method :: k) (m :: * -> *) a b.
Functor m =>
(a -> b) -> Send method m a -> Send method m b
Functor, forall a. a -> Send method m a
forall {k} {method :: k} {m :: * -> *}.
Applicative m =>
Functor (Send method m)
forall k (method :: k) (m :: * -> *) a.
Applicative m =>
a -> Send method m a
forall k (method :: k) (m :: * -> *) a b.
Applicative m =>
Send method m a -> Send method m b -> Send method m a
forall k (method :: k) (m :: * -> *) a b.
Applicative m =>
Send method m a -> Send method m b -> Send method m b
forall k (method :: k) (m :: * -> *) a b.
Applicative m =>
Send method m (a -> b) -> Send method m a -> Send method m b
forall k (method :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Send method m a -> Send method m b -> Send method m c
forall a b. Send method m a -> Send method m b -> Send method m a
forall a b. Send method m a -> Send method m b -> Send method m b
forall a b.
Send method m (a -> b) -> Send method m a -> Send method m b
forall a b c.
(a -> b -> c)
-> Send method m a -> Send method m b -> Send method m c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
<* :: forall a b. Send method m a -> Send method m b -> Send method m a
$c<* :: forall k (method :: k) (m :: * -> *) a b.
Applicative m =>
Send method m a -> Send method m b -> Send method m a
*> :: forall a b. Send method m a -> Send method m b -> Send method m b
$c*> :: forall k (method :: k) (m :: * -> *) a b.
Applicative m =>
Send method m a -> Send method m b -> Send method m b
liftA2 :: forall a b c.
(a -> b -> c)
-> Send method m a -> Send method m b -> Send method m c
$cliftA2 :: forall k (method :: k) (m :: * -> *) a b c.
Applicative m =>
(a -> b -> c)
-> Send method m a -> Send method m b -> Send method m c
<*> :: forall a b.
Send method m (a -> b) -> Send method m a -> Send method m b
$c<*> :: forall k (method :: k) (m :: * -> *) a b.
Applicative m =>
Send method m (a -> b) -> Send method m a -> Send method m b
pure :: forall a. a -> Send method m a
$cpure :: forall k (method :: k) (m :: * -> *) a.
Applicative m =>
a -> Send method m a
Applicative, forall a. a -> Send method m a
forall {k} {method :: k} {m :: * -> *}.
Monad m =>
Applicative (Send method m)
forall k (method :: k) (m :: * -> *) a.
Monad m =>
a -> Send method m a
forall k (method :: k) (m :: * -> *) a b.
Monad m =>
Send method m a -> Send method m b -> Send method m b
forall k (method :: k) (m :: * -> *) a b.
Monad m =>
Send method m a -> (a -> Send method m b) -> Send method m b
forall a b. Send method m a -> Send method m b -> Send method m b
forall a b.
Send method m a -> (a -> Send method m b) -> Send method m b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: forall a. a -> Send method m a
$creturn :: forall k (method :: k) (m :: * -> *) a.
Monad m =>
a -> Send method m a
>> :: forall a b. Send method m a -> Send method m b -> Send method m b
$c>> :: forall k (method :: k) (m :: * -> *) a b.
Monad m =>
Send method m a -> Send method m b -> Send method m b
>>= :: forall a b.
Send method m a -> (a -> Send method m b) -> Send method m b
$c>>= :: forall k (method :: k) (m :: * -> *) a b.
Monad m =>
Send method m a -> (a -> Send method m b) -> Send method m b
Monad, forall a. IO a -> Send method m a
forall {k} {method :: k} {m :: * -> *}.
MonadIO m =>
Monad (Send method m)
forall k (method :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Send method m a
forall (m :: * -> *).
Monad m -> (forall a. IO a -> m a) -> MonadIO m
liftIO :: forall a. IO a -> Send method m a
$cliftIO :: forall k (method :: k) (m :: * -> *) a.
MonadIO m =>
IO a -> Send method m a
MonadIO)
instance MonadTrans (Send method) where
lift :: forall (m :: * -> *) a. Monad m => m a -> Send method m a
lift = forall {k} {k} (method :: k) (m :: k -> *) (a :: k).
m a -> Send method m a
Send
data GET
data POST
data PUT
data DELETE
data OPTIONS
data HEAD
data PATCH
data TRACE
type Get m a = Send GET m a
type Post m a = Send POST m a
type Put m a = Send PUT m a
type Delete m a = Send DELETE m a
type Options m a = Send OPTIONS m a
type Head m a = Send HEAD m a
type Patch m a = Send PATCH m a
type Trace m a = Send TRACE m a
class IsMethod a where
toMethod :: Method
instance IsMethod GET where
toMethod :: Method
toMethod = Method
methodGet
instance IsMethod POST where
toMethod :: Method
toMethod = Method
methodPost
instance IsMethod PUT where
toMethod :: Method
toMethod = Method
methodPut
instance IsMethod DELETE where
toMethod :: Method
toMethod = Method
methodDelete
instance IsMethod OPTIONS where
toMethod :: Method
toMethod = Method
methodOptions
instance IsMethod HEAD where
toMethod :: Method
toMethod = Method
methodHead
instance IsMethod PATCH where
toMethod :: Method
toMethod = Method
methodPatch
instance IsMethod TRACE where
toMethod :: Method
toMethod = Method
methodTrace