ycextra-0.1: Additional utilities to work with Yhc Core.

Yhc.Core.Annotation

Synopsis

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.

class CoreProperty p whereSource

For each property, an encoding (to String) and decoding (from String) functions should be defined.

Methods

toAnnStringSource

Arguments

:: p 
-> String

arbitrary property to a string to store

fromAnnStringSource

Arguments

:: Monad m 
=> String 
-> m p

from stored string to property value or fail

addAnnotationSource

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.

getAnnotationSource

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.