imperative-edsl-0.9: Deep embedding of imperative programs with code generation
Safe HaskellNone
LanguageHaskell2010

Language.Embedded.Concurrent.CMD

Synopsis

Documentation

type TID = VarId Source #

data ThreadId Source #

Constructors

TIDRun ThreadId (Flag ()) 
TIDComp TID 

Instances

Instances details
Show ThreadId Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

ToIdent ThreadId Source # 
Instance details

Defined in Language.Embedded.Concurrent.Backend.C

Methods

toIdent :: ThreadId -> SrcLoc -> Id #

type CID = VarId Source #

data Chan t a Source #

A bounded channel.

Constructors

ChanRun (Chan Dynamic) 
ChanComp CID 

Instances

Instances details
ToIdent (Chan t a) Source # 
Instance details

Defined in Language.Embedded.Concurrent.Backend.C

Methods

toIdent :: Chan t a -> SrcLoc -> Id #

data ChanSize exp pred i where Source #

Channel size specification. For each possible element type, it shows how many elements of them could be stored in the given channel at once.

Constructors

OneSize :: (pred a, Integral i) => proxy a -> exp i -> ChanSize exp pred i 
TimesSize :: Integral i => exp i -> ChanSize exp pred i -> ChanSize exp pred i 
PlusSize :: Integral i => ChanSize exp pred i -> ChanSize exp pred i -> ChanSize exp pred i 

timesSizeOf :: (pred a, Integral i) => exp i -> proxy a -> ChanSize exp pred i Source #

Takes n times the size of type refered by proxy.

timesSize :: Integral i => exp i -> ChanSize exp pred i -> ChanSize exp pred i Source #

Multiplies a channel size specification with a scalar.

plusSize :: Integral i => ChanSize exp pred i -> ChanSize exp pred i -> ChanSize exp pred i Source #

Adds two channel size specifications together.

data ThreadCMD fs a where Source #

Constructors

ForkWithId :: (ThreadId -> prog ()) -> ThreadCMD (Param3 prog exp pred) ThreadId 
Kill :: ThreadId -> ThreadCMD (Param3 prog exp pred) () 
Wait :: ThreadId -> ThreadCMD (Param3 prog exp pred) () 
Sleep :: Integral i => exp i -> ThreadCMD (Param3 prog exp pred) () 

Instances

Instances details
(ThreadCMD :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) :<: instr => Reexpressible (ThreadCMD :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) (instr :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) env Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

reexpressInstrEnv :: forall (m :: Type -> Type) exp1 exp2 (fs :: k1) a. Monad m => (forall (b :: k). exp1 b -> ReaderT env (ProgramT instr '(exp2, fs) m) (exp2 b)) -> ThreadCMD '(ReaderT env (ProgramT instr '(exp2, fs) m), '(exp1, fs)) a -> ReaderT env (ProgramT instr '(exp2, fs) m) a #

InterpBi (ThreadCMD :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) IO (Param1 pred :: (k2, Type)) Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

interpBi :: forall (a :: k). ThreadCMD '(IO, '(IO, Param1 pred)) a -> IO a #

CompExp exp => Interp (ThreadCMD :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) CGen (Param2 exp pred :: (Type -> Type, (k2, Type))) Source # 
Instance details

Defined in Language.Embedded.Concurrent.Backend.C

Methods

interp :: forall (a :: k). ThreadCMD '(CGen, Param2 exp pred) a -> CGen a #

HFunctor (ThreadCMD :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

hfmap :: forall f g (fs :: k1) (a :: k20). (forall (b :: k). f b -> g b) -> ThreadCMD '(f, fs) a -> ThreadCMD '(g, fs) a #

HBifunctor (ThreadCMD :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

hbimap :: forall f g i j (fs :: k1) (a :: k20). (Functor f, Functor g) => (forall b. f b -> g b) -> (forall (b :: k). i b -> j b) -> ThreadCMD '(f, '(i, fs)) a -> ThreadCMD '(g, '(j, fs)) a #

DryInterp (ThreadCMD :: (Type -> Type, (Type -> Type, (k2, Type))) -> Type -> Type) Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

dryInterp :: forall m (fs :: k) a. MonadSupply m => ThreadCMD '(m, fs) a -> m a Source #

data ChanCMD fs a where Source #

Constructors

NewChan :: ChanSize exp pred i -> ChanCMD (Param3 prog exp pred) (Chan t c) 
CloseChan :: Chan Closeable c -> ChanCMD (Param3 prog exp pred) () 
ReadOK :: Chan Closeable c -> ChanCMD (Param3 prog exp pred) (Val Bool) 
ReadOne :: (Typeable a, pred a) => Chan t c -> ChanCMD (Param3 prog exp pred) (Val a) 
WriteOne :: (Typeable a, pred a) => Chan t c -> exp a -> ChanCMD (Param3 prog exp pred) (Val Bool) 
ReadChan :: (Typeable a, pred a, pred i, Ix i, Integral i) => Chan t c -> exp i -> exp i -> Arr i a -> ChanCMD (Param3 prog exp pred) (Val Bool) 
WriteChan :: (Typeable a, pred a, pred i, Ix i, Integral i) => Chan t c -> exp i -> exp i -> Arr i a -> ChanCMD (Param3 prog exp pred) (Val Bool) 

Instances

Instances details
HFunctor (ChanCMD :: (k -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

hfmap :: forall f g (fs :: k1) (a :: k2). (forall (b :: k0). f b -> g b) -> ChanCMD '(f, fs) a -> ChanCMD '(g, fs) a #

(ChanCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) :<: instr => Reexpressible (ChanCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) (instr :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) env Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

reexpressInstrEnv :: forall (m :: Type -> Type) exp1 exp2 (fs :: k1) a. Monad m => (forall (b :: k). exp1 b -> ReaderT env (ProgramT instr '(exp2, fs) m) (exp2 b)) -> ChanCMD '(ReaderT env (ProgramT instr '(exp2, fs) m), '(exp1, fs)) a -> ReaderT env (ProgramT instr '(exp2, fs) m) a #

InterpBi (ChanCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) IO (Param1 pred :: (Type -> Constraint, Type)) Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

interpBi :: forall (a :: k). ChanCMD '(IO, '(IO, Param1 pred)) a -> IO a #

(CompExp exp, CompTypeClass ct, ct Bool) => Interp (ChanCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) CGen (Param2 exp ct :: (Type -> Type, (Type -> Constraint, Type))) Source # 
Instance details

Defined in Language.Embedded.Concurrent.Backend.C

Methods

interp :: forall (a :: k). ChanCMD '(CGen, Param2 exp ct) a -> CGen a #

HBifunctor (ChanCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

hbimap :: forall f g i j (fs :: k1) (a :: k2). (Functor f, Functor g) => (forall b. f b -> g b) -> (forall (b :: k). i b -> j b) -> ChanCMD '(f, '(i, fs)) a -> ChanCMD '(g, '(j, fs)) a #

DryInterp (ChanCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

Methods

dryInterp :: forall m (fs :: k) a. MonadSupply m => ChanCMD '(m, fs) a -> m a Source #

Orphan instances

FreeExp IO Source # 
Instance details

Associated Types

type FreePred IO :: Type -> Constraint Source #

Methods

constExp :: FreePred IO a => a -> IO a Source #

varExp :: FreePred IO a => VarId -> IO a Source #