effective-aspects- A monadic embedding of aspect oriented programming

Safe HaskellNone




Join points

data Jp m a b Source

Join points are function applications. We store the function and the argument, and the function type representation. | We add a FunctionTag value to use for quantification.


(Typeable1Monad m, PolyTypeable (a -> m b)) => Jp (a -> m b) FunctionTag a TypeRep 


Typeable1 m => Typeable2 (Jp m)

Support for PolyTypeable

newjp :: (Typeable1Monad m, PolyTypeable (a -> m b)) => (a -> m b) -> FunctionTag -> a -> Jp m a bSource

Creates a join point with given function, tag, and argument

compareFun :: (Typeable1Monad m, PolyTypeable (a -> m b)) => t -> FunctionTag -> Jp m a b -> BoolSource

Comparing identity of functions:

compareType :: (Typeable1Monad m, PolyTypeable (a -> m b)) => TypeRep -> Jp m a b -> BoolSource

Compare types to see if type representation t is less general | than the type of the function associated to the join point

getJpArg :: Monad m => Jp m a b -> aSource

Gets the argument bound to the join point

data PC m a b Source

A pointcut is a predicate on the current join point. It is used to identify join points of interest.




mpcond :: forall a' b'. m (Jp m a' b' -> m Bool)


runPC :: Monad m => PC m t t1 -> Jp m a' b' -> m BoolSource

Extracts the computation resulting of applying a join point to the pointcut

data RequirePC m a b Source

A RequirePC is not a valid standalone pointcut, it reflects a type requirement and must be combined with a standard PC.


Typeable1Monad m => RequirePC 


mpcond' :: forall a' b'. m (Jp m a' b' -> m Bool)


type Advice m a b = (a -> m b) -> a -> m bSource

applyAdv :: Advice m a b -> t2 -> t2Source

Coerces t2 to be compatible with the advice. It passes t1 as a the proceed argument of the advice. This coercion is safe, as described in the paper.

data Aspect m a b c d Source

Typed first-class aspect. An aspect is tagged with a Unique value, used for identity


LessGen (a -> b) (c -> m d) => Aspect (PC m a b) (Advice m c d) AspectHandle 


Show (Aspect m a b c d) 

aspect :: (Typeable1Monad m, LessGen (a1 -> b1) (a2 -> m b2)) => PC m a1 b1 -> Advice m a2 b2 -> Aspect m a1 b1 a2 b2Source

Constructs a well-typed aspect

deleteAsp :: Typeable1Monad m => EAspect m -> AspectEnv m -> AspectEnv mSource

Deletes asp from the aspect environment, used in undeploy

data EAspect m Source

Aspect with hidden types, to be used in the aspect environment


forall a b c d . LessGen (a -> b) (c -> m d) => EAspect (Aspect m a b c d) 


Typeable1Monad m => Eq (EAspect m)

Notion of aspect equality to delete aspects from the aspect environment

Show (EAspect m) 

type AspectEnv m = [EAspect m]Source

Aspect environment