Safe Haskell | None |
---|---|

Language | Haskell2010 |

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.

- type Serializable a = (Binary a, Typeable a)
- data Closure a where
- closure :: StaticPtr a -> Closure a
- unclosure :: Closure a -> a
- cpure :: Closure (Dict (Serializable a)) -> a -> Closure a
- cap :: Typeable a => Closure (a -> b) -> Closure a -> Closure b
- capDup :: Typeable a => Closure (Closure a -> b) -> Closure a -> Closure b
- cmap :: Typeable a => StaticPtr (a -> b) -> Closure a -> Closure b
- cduplicate :: Closure a -> Closure (Closure a)

# Documentation

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

Values that can be sent across the network.

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.

closure :: StaticPtr a -> Closure a Source #

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

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.