domaindriven-0.5.0: Batteries included event sourcing and CQRS
Safe HaskellSafe-Inferred
LanguageHaskell2010

DomainDriven.Server.TH

Synopsis

Documentation

config ''MyAction)

guardReturnVar :: Show flag => TyVarBndr flag -> Q () Source #

matchP :: Type -> Either String Pmatch Source #

Tries to match a Type to a more easily readable Pmatch. Successful match means the type is representing the type family P

mkServerSpec :: ServerConfig -> GadtName -> Q ApiSpec Source #

Create a ApiSpec from a GADT The GADT must have one parameter representing the return type

askApiNameAndParams :: ApiSpec -> ServerGenM (Name, [TyVarBndr ()]) Source #

Name and type variables used by API

mkEndpointApiType :: ApiPiece -> ServerGenM (Type, [TyVarBndr ()]) Source #

Create endpoint types to be referenced in the API * For Endpoint this is just a reference to the handler type * For SubApi we apply the path parameters before referencing the SubApi

mkHandlerTypeDec :: ApiPiece -> ServerGenM [Dec] Source #

Defines the servant types for the endpoints For SubApi it will trigger the full creating of the sub server with types and all

Result will be something like: ``` type Customer_CreateEndpoint = Create :> ReqBody '[JSON] (NamedField1 Customer_Create Name Email) :> Post '[JSON] CustomerKey

mkServerDec :: ApiSpec -> ServerGenM [Dec] Source #

Declare then handlers for the API

getUsedTyVars :: forall flag. [TyVarBndr flag] -> Type -> [TyVarBndr flag] Source #

Get the subset of type varaibes used ty a type, in the roder they're applied Used to avoid rendundant type variables in the forall statement of sub-servers

getUsedTyVarNames :: Type -> [Name] Source #

Get the type variables (VarT) used in a type, returned in the order they're referenced

mkCmdHandlerSignature :: GadtType -> ConstructorName -> ConstructorArgs -> EpReturnType -> ServerGenM Type Source #

Makes command handler, e.g. counterCmd_AddToCounterHandler :: ActionRunner m CounterCmd -> NamedFields1 CounterCmd_AddToCounter Int -> m Int

mkApiPieceHandler :: GadtType -> ApiPiece -> ServerGenM [Dec] Source #

Define the servant handler for an enpoint or referens the subapi with path parameters applied

mkReturnType :: EpReturnType -> Type Source #

Handles the special case of () being transformed into NoContent