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

Language.Embedded.Imperative

Description

Deep embedding of imperative programs with code generation. This is the main module for users who want to write imperative programs.

The Program type is parameterized by an instruction set that can be combined in a modular way; e.g:

type MyProg exp a = Program (RefCMD exp :+: FileCMD exp) a

Also, instructions are parameterized on the expression language.

Some examples of using the library are found in the examples directory.

Synopsis

Program monad

data ProgramT (instr :: (Type -> Type, k) -> Type -> Type) (fs :: k) (m :: Type -> Type) a #

Representation of programs parameterized by the primitive instructions (transformer version)

Instances

Instances details
MonadTrans (ProgramT instr fs) 
Instance details

Defined in Control.Monad.Operational.Higher

Methods

lift :: Monad m => m a -> ProgramT instr fs m a #

Monad m => Monad (ProgramT instr fs m) 
Instance details

Defined in Control.Monad.Operational.Higher

Methods

(>>=) :: ProgramT instr fs m a -> (a -> ProgramT instr fs m b) -> ProgramT instr fs m b #

(>>) :: ProgramT instr fs m a -> ProgramT instr fs m b -> ProgramT instr fs m b #

return :: a -> ProgramT instr fs m a #

Monad m => Functor (ProgramT instr fs m) 
Instance details

Defined in Control.Monad.Operational.Higher

Methods

fmap :: (a -> b) -> ProgramT instr fs m a -> ProgramT instr fs m b #

(<$) :: a -> ProgramT instr fs m b -> ProgramT instr fs m a #

Monad m => Applicative (ProgramT instr fs m) 
Instance details

Defined in Control.Monad.Operational.Higher

Methods

pure :: a -> ProgramT instr fs m a #

(<*>) :: ProgramT instr fs m (a -> b) -> ProgramT instr fs m a -> ProgramT instr fs m b #

liftA2 :: (a -> b -> c) -> ProgramT instr fs m a -> ProgramT instr fs m b -> ProgramT instr fs m c #

(*>) :: ProgramT instr fs m a -> ProgramT instr fs m b -> ProgramT instr fs m b #

(<*) :: ProgramT instr fs m a -> ProgramT instr fs m b -> ProgramT instr fs m a #

((FileCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) :<: instr, a ~ ()) => PrintfType (ProgramT instr (Param2 exp pred) m a) Source # 
Instance details

Defined in Language.Embedded.Imperative.Frontend

Associated Types

type PrintfExp (ProgramT instr (Param2 exp pred) m a) :: Type -> Type Source #

Methods

fprf :: Handle -> String -> [PrintfArg (PrintfExp (ProgramT instr (Param2 exp pred) m a))] -> ProgramT instr (Param2 exp pred) m a Source #

type PrintfExp (ProgramT instr (Param2 exp pred) m a) Source # 
Instance details

Defined in Language.Embedded.Imperative.Frontend

type PrintfExp (ProgramT instr (Param2 exp pred) m a) = exp

type Program (instr :: (Type -> Type, k) -> Type -> Type) (fs :: k) = ProgramT instr fs Identity #

Representation of programs parameterized by the primitive instructions

interpretT #

Arguments

:: forall k (i :: (Type -> Type, k) -> Type -> Type) m (fs :: k) n a. (Interp i m fs, HFunctor i, Monad m) 
=> (forall b. n b -> m b)

Interpretation of the underlying monad

-> ProgramT i fs n a 
-> m a 

Interpret a program in a monad. The interpretation of instructions is provided by the Interp class.

interpret :: forall k (i :: (Type -> Type, k) -> Type -> Type) m (fs :: k) a. (Interp i m fs, HFunctor i, Monad m) => Program i fs a -> m a #

Interpret a program in a monad. The interpretation of instructions is provided by the Interp class.

interpretBiT #

Arguments

:: forall k (i :: (Type -> Type, (Type -> Type, k)) -> Type -> Type) m (fs :: k) n exp a. (InterpBi i m fs, HBifunctor i, Functor m, Monad m, Monad n) 
=> (forall b. exp b -> m b)

Interpretation of the exp sub-structure

-> (forall b. n b -> m b)

Interpretation of the underlying monad

-> ProgramT i '(exp, fs) n a 
-> m a 

Interpret a program in a monad. The interpretation of instructions is provided by the InterpBi class.

interpretBi #

Arguments

:: forall k (i :: (Type -> Type, (Type -> Type, k)) -> Type -> Type) m (fs :: k) exp a. (InterpBi i m fs, HBifunctor i, Functor m, Monad m) 
=> (forall b. exp b -> m b)

Interpretation of the exp sub-structure

-> Program i '(exp, fs) a 
-> m a 

Interpret a program in a monad. The interpretation of instructions is provided by the InterpBi class.

type Param1 (a :: k) = '(a, Param0) #

Singleton parameter list

type Param2 (a :: k) (b :: k1) = '(a, Param1 b) #

Two-element parameter list

type Param3 (a :: k) (b :: k1) (c :: k2) = '(a, Param2 b c) #

Three-element parameter list

Imperative instructions

data RefCMD fs a Source #

Commands for mutable references

Instances

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

(RefCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) :<: instr => Reexpressible (RefCMD :: (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.Imperative.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)) -> RefCMD '(ReaderT env (ProgramT instr '(exp2, fs) m), '(exp1, fs)) a -> ReaderT env (ProgramT instr '(exp2, fs) m) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

(CompExp exp, CompTypeClass ct) => Interp (RefCMD :: (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.Imperative.Backend.C

Methods

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

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

Defined in Language.Embedded.Imperative.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) -> RefCMD '(f, '(i, fs)) a -> RefCMD '(g, '(j, fs)) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

data ArrCMD fs a Source #

Commands for mutable arrays

Instances

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

(ArrCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) :<: instr => Reexpressible (ArrCMD :: (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.Imperative.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)) -> ArrCMD '(ReaderT env (ProgramT instr '(exp2, fs) m), '(exp1, fs)) a -> ReaderT env (ProgramT instr '(exp2, fs) m) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

(CompExp exp, CompTypeClass ct) => Interp (ArrCMD :: (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.Imperative.Backend.C

Methods

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

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

Defined in Language.Embedded.Imperative.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) -> ArrCMD '(f, '(i, fs)) a -> ArrCMD '(g, '(j, fs)) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

data ControlCMD fs a Source #

Instances

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

Defined in Language.Embedded.Imperative.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)) -> ControlCMD '(ReaderT env (ProgramT instr '(exp2, fs) m), '(exp1, fs)) a -> ReaderT env (ProgramT instr '(exp2, fs) m) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

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

Defined in Language.Embedded.Imperative.Backend.C

Methods

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

HFunctor ControlCMD Source # 
Instance details

Defined in Language.Embedded.Imperative.CMD

Methods

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

HBifunctor ControlCMD Source # 
Instance details

Defined in Language.Embedded.Imperative.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) -> ControlCMD '(f, '(i, fs)) a -> ControlCMD '(g, '(j, fs)) a #

DryInterp ControlCMD Source # 
Instance details

Defined in Language.Embedded.Imperative.CMD

Methods

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

data PtrCMD fs a Source #

Instances

Instances details
HFunctor (PtrCMD :: (k -> Type, (k1, (k2, Type))) -> Type -> Type) Source # 
Instance details

Defined in Language.Embedded.Imperative.CMD

Methods

hfmap :: forall f g (fs :: k10) (a :: k20). (forall (b :: k0). f b -> g b) -> PtrCMD '(f, fs) a -> PtrCMD '(g, fs) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

Interp (PtrCMD :: (Type -> Type, (k1, (k2, Type))) -> Type -> Type) CGen (Param2 exp ct :: (k1, (k2, Type))) Source # 
Instance details

Defined in Language.Embedded.Imperative.Backend.C

Methods

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

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

data FileCMD fs a Source #

Instances

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

(FileCMD :: (Type -> Type, (Type -> Type, (Type -> Constraint, Type))) -> Type -> Type) :<: instr => Reexpressible (FileCMD :: (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.Imperative.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)) -> FileCMD '(ReaderT env (ProgramT instr '(exp2, fs) m), '(exp1, fs)) a -> ReaderT env (ProgramT instr '(exp2, fs) m) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

(CompExp exp, CompTypeClass ct, ct Bool) => Interp (FileCMD :: (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.Imperative.Backend.C

Methods

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

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

Defined in Language.Embedded.Imperative.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) -> FileCMD '(f, '(i, fs)) a -> FileCMD '(g, '(j, fs)) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

data C_CMD fs a Source #

Instances

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

Defined in Language.Embedded.Imperative.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)) -> C_CMD '(ReaderT env (ProgramT instr '(exp2, fs) m), '(exp1, fs)) a -> ReaderT env (ProgramT instr '(exp2, fs) m) a #

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

Defined in Language.Embedded.Imperative.CMD

Methods

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

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

Defined in Language.Embedded.Imperative.Backend.C

Methods

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

HFunctor C_CMD Source # 
Instance details

Defined in Language.Embedded.Imperative.CMD

Methods

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

HBifunctor C_CMD Source # 
Instance details

Defined in Language.Embedded.Imperative.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) -> C_CMD '(f, '(i, fs)) a -> C_CMD '(g, '(j, fs)) a #

DryInterp C_CMD Source # 
Instance details

Defined in Language.Embedded.Imperative.CMD

Methods

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

Composing instruction sets

data ((h1 :: k -> k1 -> Type) :+: (h2 :: k -> k1 -> Type)) (fs :: k) (a :: k1) infixr 9 #

Coproducts

Instances

Instances details
(f :: k1 -> k2 -> Type) :<: (f :+: g :: k1 -> k2 -> Type) 
Instance details

Defined in Data.ALaCarte

Methods

inj :: forall (fs :: k) (a :: k10). f fs a -> (f :+: g) fs a #

prj :: forall (fs :: k) (a :: k10). (f :+: g) fs a -> Maybe (f fs a) #

f :<: h => (f :: k1 -> k2 -> Type) :<: (g :+: h :: k1 -> k2 -> Type) 
Instance details

Defined in Data.ALaCarte

Methods

inj :: forall (fs :: k) (a :: k10). f fs a -> (g :+: h) fs a #

prj :: forall (fs :: k) (a :: k10). (g :+: h) fs a -> Maybe (f fs a) #

(HFunctor h1, HFunctor h2) => HFunctor (h1 :+: h2 :: (k1 -> Type, k2) -> k3 -> Type) 
Instance details

Defined in Data.ALaCarte

Methods

hfmap :: forall f g (fs :: k10) (a :: k20). (forall (b :: k). f b -> g b) -> (h1 :+: h2) '(f, fs) a -> (h1 :+: h2) '(g, fs) a #

(HBifunctor h1, HBifunctor h2) => HBifunctor (h1 :+: h2 :: (Type -> Type, (k1 -> Type, k2)) -> k3 -> Type) 
Instance details

Defined in Data.ALaCarte

Methods

hbimap :: forall f g i j (fs :: k10) (a :: k20). (Functor f, Functor g) => (forall b. f b -> g b) -> (forall (b :: k). i b -> j b) -> (h1 :+: h2) '(f, '(i, fs)) a -> (h1 :+: h2) '(g, '(j, fs)) a #

(Interp i1 m fs, Interp i2 m fs) => Interp (i1 :+: i2 :: (k1 -> Type, k2) -> k1 -> Type) (m :: k1 -> Type) (fs :: k2) 
Instance details

Defined in Control.Monad.Operational.Higher

Methods

interp :: forall (a :: k). (i1 :+: i2) '(m, fs) a -> m a #

(InterpBi i1 m fs, InterpBi i2 m fs) => InterpBi (i1 :+: i2 :: (k1 -> Type, (k1 -> Type, k2)) -> k1 -> Type) (m :: k1 -> Type) (fs :: k2) 
Instance details

Defined in Control.Monad.Operational.Higher

Methods

interpBi :: forall (a :: k). (i1 :+: i2) '(m, '(m, fs)) a -> m a #

(Reexpressible i1 instr env, Reexpressible i2 instr env) => Reexpressible (i1 :+: i2 :: (Type -> Type, (k1 -> Type, k2)) -> Type -> Type) (instr :: (Type -> Type, (k1 -> Type, k2)) -> Type -> Type) env 
Instance details

Defined in Control.Monad.Operational.Higher

Methods

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

(DryInterp i1, DryInterp i2) => DryInterp (i1 :+: i2 :: (Type -> Type, k) -> Type -> Type) Source # 
Instance details

Defined in Language.Embedded.Traversal

Methods

dryInterp :: forall m (fs :: k0) a. MonadSupply m => (i1 :+: i2) '(m, fs) a -> m a Source #

(Functor (h1 fs), Functor (h2 fs)) => Functor ((h1 :+: h2) fs) 
Instance details

Defined in Data.ALaCarte

Methods

fmap :: (a -> b) -> (h1 :+: h2) fs a -> (h1 :+: h2) fs b #

(<$) :: a -> (h1 :+: h2) fs b -> (h1 :+: h2) fs a #

class (sub :: k -> k1 -> Type) :<: (sup :: k -> k1 -> Type) #

A constraint f :<: g expresses that the signature f is subsumed by g, i.e. f can be used to construct elements in g.

Minimal complete definition

inj, prj

Instances

Instances details
(f :: k1 -> k2 -> Type) :<: (f :: k1 -> k2 -> Type) 
Instance details

Defined in Data.ALaCarte

Methods

inj :: forall (fs :: k) (a :: k10). f fs a -> f fs a #

prj :: forall (fs :: k) (a :: k10). f fs a -> Maybe (f fs a) #

(f :: k1 -> k2 -> Type) :<: (f :+: g :: k1 -> k2 -> Type) 
Instance details

Defined in Data.ALaCarte

Methods

inj :: forall (fs :: k) (a :: k10). f fs a -> (f :+: g) fs a #

prj :: forall (fs :: k) (a :: k10). (f :+: g) fs a -> Maybe (f fs a) #

f :<: h => (f :: k1 -> k2 -> Type) :<: (g :+: h :: k1 -> k2 -> Type) 
Instance details

Defined in Data.ALaCarte

Methods

inj :: forall (fs :: k) (a :: k10). f fs a -> (g :+: h) fs a #

prj :: forall (fs :: k) (a :: k10). (g :+: h) fs a -> Maybe (f fs a) #

Interface for expression types

class FreeExp exp Source #

Expressions that support injection of constants and named variables

Minimal complete definition

constExp, varExp

Instances

Instances details
FreeExp IO Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

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 #

FreeExp CExp Source # 
Instance details

Defined in Language.Embedded.CExp

Associated Types

type FreePred CExp :: Type -> Constraint Source #

Methods

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

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

type family FreePred exp :: * -> Constraint Source #

Constraint on the types of constants and variables in an expression language

Instances

Instances details
type FreePred IO Source # 
Instance details

Defined in Language.Embedded.Concurrent.CMD

type FreePred CExp Source # 
Instance details

Defined in Language.Embedded.CExp

class FreeExp exp => EvalExp exp Source #

Expressions that support evaluation

Minimal complete definition

evalExp

Instances

Instances details
EvalExp CExp Source # 
Instance details

Defined in Language.Embedded.CExp

Methods

evalExp :: CExp a -> a Source #

class FreeExp exp => CompExp exp Source #

General interface for compiling expressions

Minimal complete definition

compExp

Instances

Instances details
CompExp CExp Source # 
Instance details

Defined in Language.Embedded.CExp

Methods

compExp :: MonadC m => CExp a -> m Exp Source #

Front end

module Data.Int

module Data.Word