Safe HaskellSafe-Infered

AOP.Internal.Function

Synopsis

Documentation

data Function a b

Constructors

Function 

Fields

fun :: a -> b
 
tag :: FunctionTag
 

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.

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 = Unique

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 :: Unique

Creates a tag to be used for regular functions. GHC guarantees that newUnique yields a unique value every time it is applied.

newTag :: Unique

Creates a tag to be used for tagged function. GHC guarantees that newUnique yields a unique value every time it is applied.