reflex-0.7.0.0: Higher-order Functional Reactive Programming
Safe HaskellSafe
LanguageHaskell2010

Reflex.Requester.Class

Description

This module defines Requester, which indicates that an action can make requests and receive responses to them. Typically, this is used for things like a WebSocket, where it's desirable to collect many potential sources of events and send them over a single channel, then distribute the results back out efficiently to their original request sites.

Synopsis

Documentation

class (Reflex t, Monad m) => Requester t m | m -> t where Source #

A Requester action can trigger requests of type Request m a based on Events, and receive responses of type Response m a in return. Note that the a type can vary within the Requester action, but will be linked for a given request. For example, if Request m is IO and Response m is Identity, then requestingIdentity has the same type as performEvent.

Associated Types

type Request m :: * -> * Source #

The type of requests that this Requester can emit

type Response m :: * -> * Source #

The type of responses that this Requester can receive

Methods

requesting :: Event t (Request m a) -> m (Event t (Response m a)) Source #

Emit a request whenever the given Event fires, and return responses in the resulting Event.

requesting_ :: Event t (Request m a) -> m () Source #

Emit a request whenever the given Event fires, and ignore all responses.

Instances

Instances details
Requester t m => Requester t (StateT s m) Source # 
Instance details

Defined in Reflex.Requester.Class

Associated Types

type Request (StateT s m) :: Type -> Type Source #

type Response (StateT s m) :: Type -> Type Source #

Methods

requesting :: Event t (Request (StateT s m) a) -> StateT s m (Event t (Response (StateT s m) a)) Source #

requesting_ :: Event t (Request (StateT s m) a) -> StateT s m () Source #

Requester t m => Requester t (StateT s m) Source # 
Instance details

Defined in Reflex.Requester.Class

Associated Types

type Request (StateT s m) :: Type -> Type Source #

type Response (StateT s m) :: Type -> Type Source #

Methods

requesting :: Event t (Request (StateT s m) a) -> StateT s m (Event t (Response (StateT s m) a)) Source #

requesting_ :: Event t (Request (StateT s m) a) -> StateT s m () Source #

Requester t m => Requester t (ReaderT r m) Source # 
Instance details

Defined in Reflex.Requester.Class

Associated Types

type Request (ReaderT r m) :: Type -> Type Source #

type Response (ReaderT r m) :: Type -> Type Source #

Methods

requesting :: Event t (Request (ReaderT r m) a) -> ReaderT r m (Event t (Response (ReaderT r m) a)) Source #

requesting_ :: Event t (Request (ReaderT r m) a) -> ReaderT r m () Source #

Requester t m => Requester t (EventWriterT t w m) Source # 
Instance details

Defined in Reflex.EventWriter.Base

Associated Types

type Request (EventWriterT t w m) :: Type -> Type Source #

type Response (EventWriterT t w m) :: Type -> Type Source #

Methods

requesting :: Event t (Request (EventWriterT t w m) a) -> EventWriterT t w m (Event t (Response (EventWriterT t w m) a)) Source #

requesting_ :: Event t (Request (EventWriterT t w m) a) -> EventWriterT t w m () Source #

Requester t m => Requester t (QueryT t q m) Source # 
Instance details

Defined in Reflex.Query.Base

Associated Types

type Request (QueryT t q m) :: Type -> Type Source #

type Response (QueryT t q m) :: Type -> Type Source #

Methods

requesting :: Event t (Request (QueryT t q m) a) -> QueryT t q m (Event t (Response (QueryT t q m) a)) Source #

requesting_ :: Event t (Request (QueryT t q m) a) -> QueryT t q m () Source #

Requester t m => Requester t (DynamicWriterT t w m) Source # 
Instance details

Defined in Reflex.DynamicWriter.Base

Associated Types

type Request (DynamicWriterT t w m) :: Type -> Type Source #

type Response (DynamicWriterT t w m) :: Type -> Type Source #

Requester t m => Requester t (BehaviorWriterT t w m) Source # 
Instance details

Defined in Reflex.BehaviorWriter.Base

Associated Types

type Request (BehaviorWriterT t w m) :: Type -> Type Source #

type Response (BehaviorWriterT t w m) :: Type -> Type Source #

(Reflex t, Monad m) => Requester t (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Associated Types

type Request (RequesterT t request response m) :: Type -> Type Source #

type Response (RequesterT t request response m) :: Type -> Type Source #

Methods

requesting :: Event t (Request (RequesterT t request response m) a) -> RequesterT t request response m (Event t (Response (RequesterT t request response m) a)) Source #

requesting_ :: Event t (Request (RequesterT t request response m) a) -> RequesterT t request response m () Source #

Requester t m => Requester (ProfiledTimeline t) (ProfiledM m) Source # 
Instance details

Defined in Reflex.Profiled

Associated Types

type Request (ProfiledM m) :: Type -> Type Source #

type Response (ProfiledM m) :: Type -> Type Source #

withRequesting :: (Requester t m, MonadFix m) => (Event t (Response m a) -> m (Event t (Request m a), r)) -> m r Source #

requestingIdentity :: (Requester t m, Response m ~ Identity) => Event t (Request m a) -> m (Event t a) Source #

Emit a request whenever the given Event fires, and unwrap the responses before returning them. Response m must be Identity.