Skip to content

Commit

Permalink
Merge pull request #104 from gleachkr/key-val-annotations
Browse files Browse the repository at this point in the history
create KeyVal Annotation constructor
  • Loading branch information
cchalmers authored Dec 23, 2018
2 parents cdef18b + fb2728b commit ad76e96
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Diagrams/Core/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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:
--
Expand Down

0 comments on commit ad76e96

Please sign in to comment.