about summary refs log tree commit diff
path: root/nix/tag/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/tag/default.nix')
-rw-r--r--nix/tag/default.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/nix/tag/default.nix b/nix/tag/default.nix
index 4fe589825848..23f369c2b2d1 100644
--- a/nix/tag/default.nix
+++ b/nix/tag/default.nix
@@ -24,6 +24,18 @@ let
       val = null;
     };
 
+  # Returns the tag name of a given tag attribute set.
+  # Throws if the tag is invalid.
+  #
+  # Type: tag -> string
+  tagName = tag: (assertIsTag tag).name;
+
+  # Returns the tagged value of a given tag attribute set.
+  # Throws if the tag is invalid.
+  #
+  # Type: tag -> any
+  tagValue = tag: (assertIsTag tag).val;
+
   # like `verifyTag`, but throws the error message if it is not a tag.
   assertIsTag = tag:
     let res = verifyTag tag; in
@@ -139,7 +151,8 @@ let
 in {
    inherit
      verifyTag
-     assertIsTag
+     tagName
+     tagValue
      discr
      discrDef
      match