Yhc.Core.Annotation
- type CoreAnnotations = Map String (Map String String)
- class CoreAnnotable a where
- toAnnotationKey :: a -> String
- class CoreProperty p where
- toAnnString :: p -> String
- fromAnnString :: Monad m => String -> m p
- addAnnotation :: (CoreAnnotable a, CoreProperty p) => a -> (String, p) -> CoreAnnotations -> CoreAnnotations
- getAnnotation :: (CoreAnnotable a, CoreProperty p) => a -> String -> CoreAnnotations -> Maybe p
- combineAnnotations :: CoreAnnotations -> CoreAnnotations -> CoreAnnotations
Documentation
type CoreAnnotations = Map String (Map String String)Source
Annotations database: a two-level map to hold property mappings for each of annotated objects.
class CoreAnnotable a whereSource
For each annotable object, unique key should be generated, to be used with the top level map in the annotations database.
Methods
toAnnotationKey :: a -> StringSource
Instances
class CoreProperty p whereSource
For each property, an encoding (to String) and decoding (from String) functions should be defined.
Methods
Arguments
| :: p | |
| -> String | arbitrary property to a string to store |
Arguments
| :: (CoreAnnotable a, CoreProperty p) | |
| => a | annotable object |
| -> (String, p) | pair of name and value |
| -> CoreAnnotations | existing annotations database |
| -> CoreAnnotations | updated annotations database |
Given an annotable object, append a property with given name and value to the existing annotations database.
Arguments
| :: (CoreAnnotable a, CoreProperty p) | |
| => a | annotable object |
| -> String | property name |
| -> CoreAnnotations | annotations database |
| -> Maybe p | returned value or nothing |
combineAnnotations :: CoreAnnotations -> CoreAnnotations -> CoreAnnotationsSource
Given the two annotation sets, combine them into one. If the same object is annotated in both sets, annotations are combines for such object, and left annotations take precedence.