distributed-closure-0.4.1: Serializable closures for distributed programming.

Safe HaskellNone
LanguageHaskell2010

Control.Distributed.Closure.Internal

Description

Private internals. You should not use this module unless you are determined to monkey with the internals. This module comes with no API stability guarantees whatsoever. Use at your own risks.

Synopsis

Documentation

type Serializable a = (Binary a, Typeable a) Source #

Values that can be sent across the network.

data Closure a where Source #

Type of serializable closures. Abstractly speaking, a closure is a code reference paired together with an environment. A serializable closure includes a shareable code reference (i.e. a StaticPtr). Closures can be serialized only if all expressions captured in the environment are serializable.

Constructors

StaticPtr :: !(StaticPtr a) -> Closure a 
Encoded :: !ByteString -> Closure ByteString 
Ap :: !(Closure (a -> b)) -> !(Closure a) -> Closure b 
Duplicate :: Closure a -> Closure (Closure a) 
Closure :: a -> !(Closure a) -> Closure a 
Instances
IsStatic Closure Source # 
Instance details

Defined in Control.Distributed.Closure.Internal

Methods

fromStaticPtr :: StaticPtr a -> Closure a #

StaticFunctor Closure Source # 
Instance details

Defined in Data.Functor.Static

Methods

staticMap :: (Typeable a, Typeable b) => Closure (a -> b) -> Closure a -> Closure b Source #

StaticComonad Closure Source # 
Instance details

Defined in Control.Comonad.Static

Methods

staticExtract :: Typeable a => Closure a -> a Source #

StaticExtend Closure Source # 
Instance details

Defined in Control.Comonad.Static

StaticApply Closure Source # 
Instance details

Defined in Control.Applicative.Static

Methods

staticApply :: (Typeable a, Typeable b) => Closure (a -> b) -> Closure a -> Closure b Source #

StaticBind Closure Source # 
Instance details

Defined in Control.Monad.Static

Typeable a => Binary (Closure a) Source # 
Instance details

Defined in Control.Distributed.Closure.Internal

Methods

put :: Closure a -> Put #

get :: Get (Closure a) #

putList :: [Closure a] -> Put #

closure :: StaticPtr a -> Closure a Source #

Lift a Static pointer to a closure with an empty environment.

unclosure :: Closure a -> a Source #

Resolve a Closure to the value that it represents. Calling unclosure multiple times on the same closure is efficient: for most argument values the result is memoized.

cpure :: Closure (Dict (Serializable a)) -> a -> Closure a Source #

A closure can be created from any serializable value. cpure corresponds to Control.Applicative's pure, but restricted to lifting serializable values only.

cap :: Typeable a => Closure (a -> b) -> Closure a -> Closure b Source #

Closure application. Note that Closure is not a functor, let alone an applicative functor, even if it too has a meaningful notion of application.

capDup :: Typeable a => Closure (Closure a -> b) -> Closure a -> Closure b Source #

Nested closure application.

cmap :: Typeable a => StaticPtr (a -> b) -> Closure a -> Closure b Source #

Deprecated: Use staticMap instead.

Closure is not a Functor, in that we cannot map arbitrary functions over it. That is, we cannot define fmap. However, we can map a static pointer to a function over a Closure.

cduplicate :: Closure a -> Closure (Closure a) Source #

Turn a closure into a closure of a closure.