From fb2728b27f8af600e2a005e7223d22cbc17b0dab Mon Sep 17 00:00:00 2001 From: gleachkr Date: Wed, 21 Nov 2018 13:03:41 -0600 Subject: [PATCH] create KeyVal Annotation constructor --- src/Diagrams/Core/Types.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Diagrams/Core/Types.hs b/src/Diagrams/Core/Types.hs index a2b1424..42bdd3d 100644 --- a/src/Diagrams/Core/Types.hs +++ b/src/Diagrams/Core/Types.hs @@ -47,8 +47,8 @@ module Diagrams.Core.Types -- ** Annotations -- *** Static annotations - Annotation(Href, OpacityGroup) - , applyAnnotation, href, opacityGroup, groupOpacity + Annotation(Href, OpacityGroup, KeyVal) + , applyAnnotation, href, opacityGroup, groupOpacity, keyVal -- *** Dynamic (monoidal) annotations , UpAnnots, DownAnnots, transfToAnnot, transfFromAnnot @@ -252,6 +252,7 @@ withQDiaLeaf _ g (DelayedLeaf dgn) = g dgn data Annotation = Href String -- ^ Hyperlink | OpacityGroup Double + | KeyVal (String, String) deriving Show -- | Apply a static annotation at the root of a diagram. @@ -272,6 +273,10 @@ opacityGroup, groupOpacity :: (Metric v, OrderedField n, Semigroup m) opacityGroup = applyAnnotation . OpacityGroup groupOpacity = applyAnnotation . OpacityGroup +-- | Apply a general Key-Value annotation +keyVal :: (Metric v, OrderedField n, Semigroup m) + => (String, String) -> QDiagram b v n m -> QDiagram b v n m +keyVal = applyAnnotation . KeyVal -- | The fundamental diagram type. The type variables are as follows: --