Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Method c p r = Method {
- interfaceId :: !Word64
- methodId :: !Word16
- class (IsCap c, IsStruct p, IsStruct r) => HasMethod (name :: Symbol) c p r | name c -> p r where
- methodByLabel :: Method c p r
- newtype Pipeline a = Pipeline Pipeline
- newtype Client a = Client Client
- pipe :: (IsStruct a, ReprFor b ~ 'Ptr pr) => Field k a b -> Pipeline a -> Pipeline b
- pipelineClient :: (IsCap a, MonadSTM m) => Pipeline a -> m (Client a)
- waitPipeline :: forall a m pr. ('Ptr pr ~ ReprFor a, IsPtrRepr pr, MonadSTM m) => Pipeline a -> m (Raw 'Const a)
- class AsClient f where
- upcast :: (AsClient f, Coercible (f p) (f c), Super p c) => f c -> f p
- callB :: (AsClient f, IsCap c, IsStruct p, MonadSTM m) => Method c p r -> (forall s. PureBuilder s (Raw ('Mut s) p)) -> f c -> m (Pipeline r)
- callR :: (AsClient f, IsCap c, IsStruct p, MonadSTM m) => Method c p r -> Raw 'Const p -> f c -> m (Pipeline r)
- callP :: forall c p r f m pp. (AsClient f, IsCap c, IsStruct p, Parse p pp, MonadSTM m, MonadThrow m) => Method c p r -> pp -> f c -> m (Pipeline r)
Documentation
Represents a method on the interface type c
with parameter
type p
and return type r
.
Method | |
|
class (IsCap c, IsStruct p, IsStruct r) => HasMethod (name :: Symbol) c p r | name c -> p r where Source #
An instance
indicates that the interface
type HasMethod
name c p rc
has a method named name
with parameter type p
and
return type r
. The generated code includes instances of this
for each method in the schema.
methodByLabel :: Method c p r Source #
Instances
(TypeParam sturdyRef, TypeParam owner) => HasMethod "save" (Persistent sturdyRef owner) (Persistent'SaveParams sturdyRef owner) (Persistent'SaveResults sturdyRef owner) Source # | |
Defined in Capnp.Gen.Capnp.Persistent.New methodByLabel :: Method (Persistent sturdyRef owner) (Persistent'SaveParams sturdyRef owner) (Persistent'SaveResults sturdyRef owner) Source # | |
(TypeParam internalRef, TypeParam externalRef, TypeParam internalOwner, TypeParam externalOwner) => HasMethod "export" (RealmGateway internalRef externalRef internalOwner externalOwner) (RealmGateway'export'params internalRef externalRef internalOwner externalOwner) (Persistent'SaveResults externalRef externalOwner) Source # | |
Defined in Capnp.Gen.Capnp.Persistent.New methodByLabel :: Method (RealmGateway internalRef externalRef internalOwner externalOwner) (RealmGateway'export'params internalRef externalRef internalOwner externalOwner) (Persistent'SaveResults externalRef externalOwner) Source # | |
(TypeParam internalRef, TypeParam externalRef, TypeParam internalOwner, TypeParam externalOwner) => HasMethod "import_" (RealmGateway internalRef externalRef internalOwner externalOwner) (RealmGateway'import'params internalRef externalRef internalOwner externalOwner) (Persistent'SaveResults internalRef internalOwner) Source # | |
Defined in Capnp.Gen.Capnp.Persistent.New methodByLabel :: Method (RealmGateway internalRef externalRef internalOwner externalOwner) (RealmGateway'import'params internalRef externalRef internalOwner externalOwner) (Persistent'SaveResults internalRef internalOwner) Source # |
A
is a reference to possibly-not-resolved result from
a method call.Pipeline
a
Instances
AsClient Client Source # | |
Eq (Client a) Source # | |
Show (Client a) Source # | |
ReprFor a ~ 'Ptr ('Just 'Cap) => IsClient (Client a) Source # | |
(TypeParam sturdyRef, TypeParam owner) => Parse (Persistent sturdyRef owner) (Client (Persistent sturdyRef owner)) Source # | |
Defined in Capnp.Gen.Capnp.Persistent.New | |
(TypeParam internalRef, TypeParam externalRef, TypeParam internalOwner, TypeParam externalOwner) => Parse (RealmGateway internalRef externalRef internalOwner externalOwner) (Client (RealmGateway internalRef externalRef internalOwner externalOwner)) Source # | |
Defined in Capnp.Gen.Capnp.Persistent.New parse :: ReadCtx m 'Const => Raw 'Const (RealmGateway internalRef externalRef internalOwner externalOwner) -> m (Client (RealmGateway internalRef externalRef internalOwner externalOwner)) Source # encode :: RWCtx m s => Message ('Mut s) -> Client (RealmGateway internalRef externalRef internalOwner externalOwner) -> m (Raw ('Mut s) (RealmGateway internalRef externalRef internalOwner externalOwner)) Source # |
pipe :: (IsStruct a, ReprFor b ~ 'Ptr pr) => Field k a b -> Pipeline a -> Pipeline b Source #
Project a pipeline to a struct onto one of its pointer fields.
waitPipeline :: forall a m pr. ('Ptr pr ~ ReprFor a, IsPtrRepr pr, MonadSTM m) => Pipeline a -> m (Raw 'Const a) Source #
Wait for the result of a pipeline, and return its value.
upcast :: (AsClient f, Coercible (f p) (f c), Super p c) => f c -> f p Source #
Upcast is a (safe) cast from an interface to one of its superclasses.
Calling methods.
callB :: (AsClient f, IsCap c, IsStruct p, MonadSTM m) => Method c p r -> (forall s. PureBuilder s (Raw ('Mut s) p)) -> f c -> m (Pipeline r) Source #
Call a method. Use the provided PureBuilder
to construct the parameters.