about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ravanan/command-line-tool.scm2
-rw-r--r--ravanan/work/command-line-tool.scm14
2 files changed, 12 insertions, 4 deletions
diff --git a/ravanan/command-line-tool.scm b/ravanan/command-line-tool.scm
index 3493db1..958d99e 100644
--- a/ravanan/command-line-tool.scm
+++ b/ravanan/command-line-tool.scm
@@ -339,7 +339,7 @@ in which the G-expressions are inserted."
               (list (case type
                       ((string)
                        value)
-                      ((int)
+                      ((int float)
                        #~(number->string #$value))
                       ((File)
                        #~(assoc-ref* #$value "path"))
diff --git a/ravanan/work/command-line-tool.scm b/ravanan/work/command-line-tool.scm
index 4787e3d..9e5c8a1 100644
--- a/ravanan/work/command-line-tool.scm
+++ b/ravanan/work/command-line-tool.scm
@@ -1,5 +1,5 @@
 ;;; ravanan --- High-reproducibility CWL runner powered by Guix
-;;; Copyright © 2024 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2024, 2025 Arun Isaac <arunisaac@systemreboot.net>
 ;;;
 ;;; This file is part of ravanan.
 ;;;
@@ -52,13 +52,17 @@ directory after THUNK returns."
                   thunk
                   (cut chdir original-current-directory))))
 
-;; TODO: Support float types.
 (define (object-type obj)
   "Return the type of @var{obj}."
   (cond
    ((eq? obj 'null) 'null)
    ((boolean? obj) 'boolean)
-   ((integer? obj) 'int)
+   ((and (number? obj)
+         (inexact? obj))
+    'float)
+   ((and (number? obj)
+         (integer? obj))
+    'int)
    ((string? obj) 'string)
    ;; For vector objects, we use the first element to guess at the
    ;; subtype.
@@ -86,6 +90,10 @@ example, when @var{type} is a union type."
     (match obj
       ((or 'null #()) 'null)
       (_ #f)))
+   ;; Treat floats and doubles as the same thing. It is unclear to me why the
+   ;; CWL specification needs separate types for these.
+   ((eq? type 'double)
+    (match-type obj 'float))
    ;; Recursively match type of every element of array.
    ((array-type? type)
     (and (vector? obj)