Module

Control.Applicative.Fetch

Package
purescript-fetch
Repository
rightfold/purescript-fetch

More efficient data fetching using deduplication, batching, and caching.

#Fetch Source

data Fetch k r a

A computation that fetches data for some set of keys. Fetch computations can be combined using (<$>) and (<*>).

Instances

#fetch Source

fetch :: forall r k. Ord k => k -> Fetch k r r

A computation that fetches data for some key.

#fetchAla Source

fetchAla :: forall r' r k. Ord k => Newtype r r' => (r' -> r) -> k -> Fetch k r r'

A computation that fetches data for some key, using some wrapping resource.

#runFetch Source

runFetch :: forall a f r k. Resource k r f => Functor f => Fetch k r a -> f a

Perform a fetch computation with some resource in some context.

#Resource Source

class (Ord k) <= Resource k r f | k r -> f where

A resource implements the fetching of data.

Instances must satisfy the following laws in addition to the Ord laws:

  • Key preservation: (true <$ resource ks) = map (\m -> all (Map.member <@> m) ks) (resource ks)

Members

Instances

#Memoize Source

newtype Memoize r

Cache fetched data indefinitely.

Constructors

Instances