Safe Haskell | None |
---|
AOP.Internal.Function
- data Function a b = Function {
- fun :: a -> b
- tag :: FunctionTag
- type FunctionTag = Integer
- mkFunction :: (a -> b) -> FunctionTag -> Function a b
- defaultFunctionTag :: Integer
- newTag :: Q Exp
Documentation
data Function a b
Constructors
Function | |
Fields
|
Instances
Typeable2 Function | |
PcType Function | Type pointcut for our encoding of function identity. The function tag has no influence. |
PcCall Function | Call pointcut for our encoding of function identity. Functions that are equal have the same tag. |
PcCflowbelow Function | |
PcCflow Function | |
Typeable1Monad m => OpenApp Function (AOT_sp m) | Function is a wrapper to add a notion of identity based on tags. |
Typeable1Monad m => OpenApp Function (AOT_s m) | Function is a wrapper to add a notion of identity based on tags. |
Typeable1Monad m => OpenApp Function (AOT m) | Function is a wrapper to add a notion of identity based on tags. |
Typeable1Monad (t m) => OpenApp Function (NIAOT t m) | Open application of tagged functions. |
Eq (Function a b) | Equality of wrapped function is based on tag comparison. By construction tags are already instances of Eq. |
type FunctionTag = Integer
We define a notion of function equality based on tagging functions with identifiers: two functions are equal if they have the same identifier. We extend join point definition and weaving to support these tags. To provide compatibility with regular functions (which use StableNames for equality) we use a special default tag in join points and weaving, to distinguish regular functions from tagged functions and use the corresponding notion of equality.
mkFunction :: (a -> b) -> FunctionTag -> Function a b
Wraps a regular function into a wrapped one.
defaultFunctionTag :: Integer
Default tag to be used for regular functions. Our overloaded definitions detect this tag and use StableNames for function equality. newTag is a TemplateHaskell macro that is replaced by a unique integer (compilation-wide) at compile time.
newTag :: Q Exp
Creates a unique integer, used to identify functions. Each splice of this macro creates an integer value **only once** So if used inside of a function, **it will always evaluate to the same value**