-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A wrapping library for waitfree comnputation.
--
-- A combinator library for asynchronous waitfree computation among
-- forkIO threads.
@package waitfree
@version 0.1
module Control.Concurrent.Waitfree
-- | ZeroT is a Thread
data ZeroT
-- | 'SucT t' is a Thread if t is a Thread. The name
-- SucT comes from the successor function.
data SucT t
-- | HNil is the empty HyperSequent
data HNil
-- | 'HCons (K t e)' adds a remote computation in front of a
-- HyperSequent
data HCons e l
-- | an abreviation for HCons
type :*: e l = HCons e l
-- | A value of type 'K t a' represents a remote computation returning
-- a that is performed by a thread t.
data K t a
-- | single creates a Hyp hypersequent consisting of a single remote
-- computation.
single :: Thread t => IO a -> Hyp ((K t a) :*: HNil)
-- | hypersequent is always put in Hyp monad
data Hyp a
-- | An abstract representation of a thread. Threads are actually
-- implemented using forkIO.
class Thread t
t :: Thread t => t
atid :: Thread t => t -> AbstractThreadId
-- | Each Thread type has AbstractThreadId
type AbstractThreadId = Int
-- | comm stands for communication. comm combines two
-- hypersequents with a communicating component from each hypersequent.
comm :: (Thread s, Thread t, HAppend l l' l'') => Hyp (HCons (K t (b, a)) l) -> Hyp (HCons (K s (d, c)) l') -> Hyp (K t (b, c) :*: (K s (d, a) :*: l''))
-- | execute executes a Hyp hypersequent.
execute :: Lconvertible l => Hyp l -> IO ()
-- | extend a Hyp hypersequent with another computation
(-*-) :: (Thread t, HyperSequent l, HyperSequent l') => (t -> Maybe a -> IO (Maybe b)) -> (l -> Hyp l') -> HCons (K t a) l -> Hyp (HCons (K t b) l')
instance (Thread t, Lconvertible l) => Lconvertible (HCons (K t a) l)
instance Lconvertible HNil
instance Monad Hyp
instance (HyperSequent l, HAppend l l' l'') => HAppend (HCons x l) l' (HCons x l'')
instance HyperSequent l => HAppend HNil l l
instance HyperSequent l => HyperSequent (HCons (K t e) l)
instance HyperSequent HNil
instance Thread t => Thread (SucT t)
instance Thread ZeroT