static-closure-0.1.0.0: Serialisable static pointers to functions

Safe HaskellNone
LanguageHaskell2010

Control.Static.Closure

Description

This module contains a "closure" type, originally inspired by Closure, but modified significantly, and also generalised in a number of ways.

There was some also unsafe casts in Control.Distributed.Closure.Internal that scared me, which this package does not have.

Synopsis

Documentation

data Closure t a where Source #

Somewhat inspired by Closure but modified. Whereas Closure requires the serialised type to be a lazy ByteString, this closure type allows the serialised type to be given as a parameter.

Constructors

CPure :: !(Closure t (t -> a)) -> t -> a -> Closure t a 
CStaticPtr :: !(StaticPtr a) -> Closure t a 
CAp :: !(Closure t (a -> b)) -> !(Closure t a) -> Closure t b 

newtype Tag Source #

Constructors

Tag Word8 

Instances

Binary Tag Source # 

Methods

put :: Tag -> Put #

get :: Get Tag #

putList :: [Tag] -> Put #

pattern PureTag :: Tag Source #

pattern ApTag :: Tag Source #

putClosure :: Binary t => Closure t a -> Put Source #

Inspired by putClosure.

getClosure :: Binary t => Get (Closure t a) Source #

Inspired by getDynClosure, but I think simplified.