From d9f744ac19fd38dbe83159366ecc7d902be398a9 Mon Sep 17 00:00:00 2001 From: niten Date: Mon, 30 May 2022 15:42:27 -0700 Subject: [PATCH] Add support for symbols. --- to-edn.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/to-edn.nix b/to-edn.nix index 738e675..ffde9f5 100644 --- a/to-edn.nix +++ b/to-edn.nix @@ -2,10 +2,14 @@ with lib; let + isSymbol = str: isNull (match "^'.+" str); + stripQuote = head (match "^'(.+)"); + parseStr = str: if (isSymbol str) then (stripQuote str) else ''"${str}"''; + join-str = concatStringsSep " "; toEDN = ds: if isString ds then - ''"${ds}"'' + parseStr ds else (if isInt ds then ds