okapi-0.2.0.0: A bidirectional HTTP description language
Safe HaskellNone
LanguageGHC2024

Okapi.Mode.Function

Documentation

data Function (n :: Type -> Type) shape where Source #

Constructors

Fn :: forall method path query headers body (n :: Type -> Type) result. ((Request method path query headers body, Request) -> n result) -> Function n (Shape method path query headers body result) 

Instances

Instances details
GFunction n (S1 sm (Rec0 (Forest (Shape method path query headers body result)))) (S1 sm' (Rec0 (Function n (Shape method path query headers body result)))) Source # 
Instance details

Defined in Okapi.Mode.Function

Methods

gServe :: (n ~> IO) -> S1 sm (Rec0 (Forest (Shape method path query headers body result))) () -> S1 sm' (Rec0 (Function n (Shape method path query headers body result))) () -> Middleware

fn :: ((Request method path query headers body, Request) -> n result) -> Function n (Shape method path query headers body result) Source #

type (~>) (f :: Type -> Type) (g :: Type -> Type) = forall a. f a -> g a Source #

serve :: forall (n :: Type -> Type) method path query headers body result. (n ~> IO) -> Forest (Shape method path query headers body result) -> Function n (Shape method path query headers body result) -> Application Source #

tryServe :: forall (n :: Type -> Type) method path query headers body result. (n ~> IO) -> Forest (Shape method path query headers body result) -> Function n (Shape method path query headers body result) -> Middleware Source #

class GFunction (n :: Type -> Type) (epF :: Type -> Type) (svF :: Type -> Type) Source #

Minimal complete definition

gServe

Instances

Instances details
(GFunction n epL svL, GFunction n epR svR) => GFunction n (epL :*: epR) (svL :*: svR) Source # 
Instance details

Defined in Okapi.Mode.Function

Methods

gServe :: (n ~> IO) -> (epL :*: epR) () -> (svL :*: svR) () -> Middleware

GFunction n epF svF => GFunction n (C1 cm epF) (C1 cm' svF) Source # 
Instance details

Defined in Okapi.Mode.Function

Methods

gServe :: (n ~> IO) -> C1 cm epF () -> C1 cm' svF () -> Middleware

GFunction n epF svF => GFunction n (D1 dm epF) (D1 dm' svF) Source # 
Instance details

Defined in Okapi.Mode.Function

Methods

gServe :: (n ~> IO) -> D1 dm epF () -> D1 dm' svF () -> Middleware

GFunction n (S1 sm (Rec0 (Forest (Shape method path query headers body result)))) (S1 sm' (Rec0 (Function n (Shape method path query headers body result)))) Source # 
Instance details

Defined in Okapi.Mode.Function

Methods

gServe :: (n ~> IO) -> S1 sm (Rec0 (Forest (Shape method path query headers body result))) () -> S1 sm' (Rec0 (Function n (Shape method path query headers body result))) () -> Middleware

app :: forall server (n :: Type -> Type). (Generic (server Forest), Generic (server (Function n)), GFunction n (Rep (server Forest)) (Rep (server (Function n)))) => (n ~> IO) -> server Forest -> server (Function n) -> Application Source #