reflex-0.8.2.1: Higher-order Functional Reactive Programming
Safe HaskellNone
LanguageHaskell2010

Reflex.Requester.Base

Description

This module provides RequesterT, the standard implementation of Requester.

Synopsis

Documentation

newtype RequesterT t request (response :: Type -> Type) m a Source #

A basic implementation of Requester.

Constructors

RequesterT 

Fields

Instances

Instances details
MonadReader r m => MonadReader r (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

ask :: RequesterT t request response m r #

local :: (r -> r) -> RequesterT t request response m a -> RequesterT t request response m a #

reader :: (r -> a) -> RequesterT t request response m a #

(Reflex t, Adjustable t m, MonadHold t m, MonadFix m) => Adjustable t (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

runWithReplace :: RequesterT t request response m a -> Event t (RequesterT t request response m b) -> RequesterT t request response m (a, Event t b) Source #

traverseIntMapWithKeyWithAdjust :: (Key -> v -> RequesterT t request response m v') -> IntMap v -> Event t (PatchIntMap v) -> RequesterT t request response m (IntMap v', Event t (PatchIntMap v')) Source #

traverseDMapWithKeyWithAdjust :: GCompare k => (forall a. k a -> v a -> RequesterT t request response m (v' a)) -> DMap k v -> Event t (PatchDMap k v) -> RequesterT t request response m (DMap k v', Event t (PatchDMap k v')) Source #

traverseDMapWithKeyWithAdjustWithMove :: GCompare k => (forall a. k a -> v a -> RequesterT t request response m (v' a)) -> DMap k v -> Event t (PatchDMapWithMove k v) -> RequesterT t request response m (DMap k v', Event t (PatchDMapWithMove k v')) Source #

MonadReflexCreateTrigger t m => MonadReflexCreateTrigger t (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

newEventWithTrigger :: (EventTrigger t a -> IO (IO ())) -> RequesterT t request response m (Event t a) Source #

newFanEventWithTrigger :: GCompare k => (forall a. k a -> EventTrigger t a -> IO (IO ())) -> RequesterT t request response m (EventSelector t k) Source #

PostBuild t m => PostBuild t (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

getPostBuild :: RequesterT t request response m (Event t ()) 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 #

TriggerEvent t m => TriggerEvent t (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

newTriggerEvent :: RequesterT t request response m (Event t a, a -> IO ()) Source #

newTriggerEventWithOnComplete :: RequesterT t request response m (Event t a, a -> IO () -> IO ()) Source #

newEventWithLazyTriggerWithOnComplete :: ((a -> IO () -> IO ()) -> IO (IO ())) -> RequesterT t request response m (Event t a) Source #

PerformEvent t m => PerformEvent t (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Associated Types

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

Methods

performEvent :: Event t (Performable (RequesterT t request response m) a) -> RequesterT t request response m (Event t a) Source #

performEvent_ :: Event t (Performable (RequesterT t request response m) ()) -> RequesterT t request response m () Source #

NotReady t m => NotReady t (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.NotReady.Class

Methods

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

notReady :: RequesterT t request response m () Source #

MonadHold t m => MonadHold (t :: Type) (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

hold :: a -> Event t a -> RequesterT t request response m (Behavior t a) Source #

holdDyn :: a -> Event t a -> RequesterT t request response m (Dynamic t a) Source #

holdIncremental :: Patch p => PatchTarget p -> Event t p -> RequesterT t request response m (Incremental t p) Source #

buildDynamic :: PushM t a -> Event t a -> RequesterT t request response m (Dynamic t a) Source #

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

now :: RequesterT t request response m (Event t ()) Source #

MonadSample t m => MonadSample (t :: Type) (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

sample :: Behavior t a -> RequesterT t request response m a Source #

MFunctor (RequesterT t request response :: (Type -> Type) -> Type -> Type) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> RequesterT t request response m b -> RequesterT t request response n b #

MonadTrans (RequesterT t request response) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

lift :: Monad m => m a -> RequesterT t request response m a #

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

Defined in Reflex.Requester.Base

Methods

(>>=) :: RequesterT t request response m a -> (a -> RequesterT t request response m b) -> RequesterT t request response m b #

(>>) :: RequesterT t request response m a -> RequesterT t request response m b -> RequesterT t request response m b #

return :: a -> RequesterT t request response m a #

Functor m => Functor (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

fmap :: (a -> b) -> RequesterT t request response m a -> RequesterT t request response m b #

(<$) :: a -> RequesterT t request response m b -> RequesterT t request response m a #

MonadFix m => MonadFix (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

mfix :: (a -> RequesterT t request response m a) -> RequesterT t request response m a #

Monad m => Applicative (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

pure :: a -> RequesterT t request response m a #

(<*>) :: RequesterT t request response m (a -> b) -> RequesterT t request response m a -> RequesterT t request response m b #

liftA2 :: (a -> b -> c) -> RequesterT t request response m a -> RequesterT t request response m b -> RequesterT t request response m c #

(*>) :: RequesterT t request response m a -> RequesterT t request response m b -> RequesterT t request response m b #

(<*) :: RequesterT t request response m a -> RequesterT t request response m b -> RequesterT t request response m a #

MonadIO m => MonadIO (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

liftIO :: IO a -> RequesterT t request response m a #

MonadException m => MonadException (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

throw :: Exception e => e -> RequesterT t request response m a #

catch :: Exception e => RequesterT t request response m a -> (e -> RequesterT t request response m a) -> RequesterT t request response m a #

finally :: RequesterT t request response m a -> RequesterT t request response m b -> RequesterT t request response m a #

MonadAsyncException m => MonadAsyncException (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

mask :: ((forall a. RequesterT t request response m a -> RequesterT t request response m a) -> RequesterT t request response m b) -> RequesterT t request response m b #

PrimMonad m => PrimMonad (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Associated Types

type PrimState (RequesterT t request response m) #

Methods

primitive :: (State# (PrimState (RequesterT t request response m)) -> (# State# (PrimState (RequesterT t request response m)), a #)) -> RequesterT t request response m a #

MonadRef m => MonadRef (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

Associated Types

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

Methods

newRef :: a -> RequesterT t request response m (Ref (RequesterT t request response m) a) #

readRef :: Ref (RequesterT t request response m) a -> RequesterT t request response m a #

writeRef :: Ref (RequesterT t request response m) a -> a -> RequesterT t request response m () #

modifyRef :: Ref (RequesterT t request response m) a -> (a -> a) -> RequesterT t request response m () #

modifyRef' :: Ref (RequesterT t request response m) a -> (a -> a) -> RequesterT t request response m () #

(Semigroup a, Monad m) => Semigroup (RequesterT t request response m a) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

(<>) :: RequesterT t request response m a -> RequesterT t request response m a -> RequesterT t request response m a #

sconcat :: NonEmpty (RequesterT t request response m a) -> RequesterT t request response m a #

stimes :: Integral b => b -> RequesterT t request response m a -> RequesterT t request response m a #

(Monoid a, Monad m) => Monoid (RequesterT t request response m a) Source # 
Instance details

Defined in Reflex.Requester.Base

Methods

mempty :: RequesterT t request response m a #

mappend :: RequesterT t request response m a -> RequesterT t request response m a -> RequesterT t request response m a #

mconcat :: [RequesterT t request response m a] -> RequesterT t request response m a #

type PrimState (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

type PrimState (RequesterT t request response m) = PrimState m
type Ref (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

type Ref (RequesterT t request response m) = Ref m
type Request (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

type Request (RequesterT t request response m) = request
type Response (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

type Response (RequesterT t request response m) = response
type Performable (RequesterT t request response m) Source # 
Instance details

Defined in Reflex.Requester.Base

type Performable (RequesterT t request response m) = Performable m

runRequesterT :: (Reflex t, Monad m) => RequesterT t request response m a -> Event t (RequesterData response) -> m (a, Event t (RequesterData request)) Source #

Run a RequesterT action. The resulting Event will fire whenever requests are made, and responses should be provided in the input Event. The Tag keys will be used to return the responses to the same place the requests were issued.

withRequesterT Source #

Arguments

:: (Reflex t, MonadFix m) 
=> (forall x. req x -> req' x)

The function to map over the request

-> (forall x. rsp' x -> rsp x)

The function to map over the response

-> RequesterT t req rsp m a

The internal RequesterT whose input and output will be transformed

-> RequesterT t req' rsp' m a

The resulting RequesterT

Map a function over the request and response of a RequesterT

runWithReplaceRequesterTWith :: forall m t request response a b. (Reflex t, MonadHold t m, MonadFix m) => (forall a' b'. m a' -> Event t (m b') -> RequesterT t request response m (a', Event t b')) -> RequesterT t request response m a -> Event t (RequesterT t request response m b) -> RequesterT t request response m (a, Event t b) Source #

traverseIntMapWithKeyWithAdjustRequesterTWith :: forall t request response m v v' p. (Reflex t, MonadHold t m, PatchTarget (p (Event t (IntMap (RequesterData request)))) ~ IntMap (Event t (IntMap (RequesterData request))), Patch (p (Event t (IntMap (RequesterData request)))), Functor p, MonadFix m) => ((Key -> (Key, v) -> m (Event t (IntMap (RequesterData request)), v')) -> IntMap (Key, v) -> Event t (p (Key, v)) -> RequesterT t request response m (IntMap (Event t (IntMap (RequesterData request)), v'), Event t (p (Event t (IntMap (RequesterData request)), v')))) -> (p (Event t (IntMap (RequesterData request))) -> IntMap (Event t (IntMap (RequesterData request)))) -> (Incremental t (p (Event t (IntMap (RequesterData request)))) -> Event t (IntMap (IntMap (RequesterData request)))) -> (Key -> v -> RequesterT t request response m v') -> IntMap v -> Event t (p v) -> RequesterT t request response m (IntMap v', Event t (p v')) Source #

traverseDMapWithKeyWithAdjustRequesterTWith :: forall k t request response m v v' p p'. (GCompare k, Reflex t, MonadHold t m, PatchTarget (p' (Some k) (Event t (IntMap (RequesterData request)))) ~ Map (Some k) (Event t (IntMap (RequesterData request))), Patch (p' (Some k) (Event t (IntMap (RequesterData request)))), MonadFix m) => (forall k' v1 v2. GCompare k' => (forall a. k' a -> v1 a -> m (v2 a)) -> DMap k' v1 -> Event t (p k' v1) -> RequesterT t request response m (DMap k' v2, Event t (p k' v2))) -> (forall v1 v2. (forall a. v1 a -> v2 a) -> p k v1 -> p k v2) -> (forall v1 v2. (forall a. v1 a -> v2) -> p k v1 -> p' (Some k) v2) -> (forall v2. p' (Some k) v2 -> Map (Some k) v2) -> (forall a. Incremental t (p' (Some k) (Event t a)) -> Event t (Map (Some k) a)) -> (forall a. k a -> v a -> RequesterT t request response m (v' a)) -> DMap k v -> Event t (p k v) -> RequesterT t request response m (DMap k v', Event t (p k v')) Source #

traverseRequesterData :: forall m request response. Applicative m => (forall a. request a -> m (response a)) -> RequesterData request -> m (RequesterData response) Source #

Runs in reverse to accommodate for the fact that we accumulate it in reverse

forRequesterData :: forall request response m. Applicative m => RequesterData request -> (forall a. request a -> m (response a)) -> m (RequesterData response) Source #

traverseRequesterData with its arguments flipped

matchResponsesWithRequests Source #

Arguments

:: forall t rawRequest rawResponse request response m. (MonadFix m, MonadHold t m, Reflex t) 
=> (forall a. request a -> (rawRequest, rawResponse -> response a))

Given a request (from Requester), produces the wire format of the request and a function used to process the associated response

-> Event t (RequesterData request)

The outgoing requests

-> Event t (Int, rawResponse)

The incoming responses, tagged by an identifying key

-> m (Event t (Map Int rawRequest), Event t (RequesterData response))

A map of outgoing wire-format requests and an event of responses keyed by the RequesterData key of the associated outgoing request

matchResponseMapWithRequests Source #

Arguments

:: forall t rawRequest rawResponse request response m. (MonadFix m, MonadHold t m, Reflex t) 
=> (forall a. request a -> (rawRequest, rawResponse -> response a))

Given a request (from Requester), produces the wire format of the request and a function used to process the associated response

-> Event t (RequesterData request)

The outgoing requests

-> Event t (Map Int rawResponse)

A map of incoming responses, tagged by an identifying key

-> m (Event t (Map Int rawRequest), Event t (RequesterData response))

A map of outgoing wire-format requests and an event of responses keyed by the RequesterData key of the associated outgoing request

Matches incoming responses with previously-sent requests and uses the provided request "decoder" function to process incoming responses.

multiEntry :: IntMap (RequesterData f) -> Entry f Multi Source #

unMultiEntry :: Entry f Multi -> IntMap (RequesterData f) Source #

requesting' :: (MyTagTypeOffset x, Monad m) => Event t (Entry request x) -> RequesterT t request response m (Event t (Entry response x)) Source #