aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2024-10-02 02:10:02 +0100
committerArun Isaac2024-10-02 02:14:57 +0100
commit803a0a627fa91b00279486cbefb7263f3540f313 (patch)
tree9c742412726ee1217585c9a1f74d59066a4a6a02
parentae39d01c2f6dbdd4b144484fe15dac8e831d8393 (diff)
downloadravanan-803a0a627fa91b00279486cbefb7263f3540f313.tar.gz
ravanan-803a0a627fa91b00279486cbefb7263f3540f313.tar.lz
ravanan-803a0a627fa91b00279486cbefb7263f3540f313.zip
workflow: Move coerce-type to (ravanan reader).
* ravanan/workflow.scm (coerce-type): Move to ... * ravanan/reader.scm (coerce-type): ... here.
-rw-r--r--ravanan/reader.scm14
-rw-r--r--ravanan/workflow.scm11
2 files changed, 13 insertions, 12 deletions
diff --git a/ravanan/reader.scm b/ravanan/reader.scm
index 69c9d55..6ca36bc 100644
--- a/ravanan/reader.scm
+++ b/ravanan/reader.scm
@@ -28,7 +28,8 @@
#:use-module (ravanan work utils)
#:use-module (ravanan work vectors)
#:export (read-workflow
- read-inputs))
+ read-inputs
+ coerce-type))
(define (preprocess-include tree)
(cond
@@ -269,3 +270,14 @@ each association list of the returned vector of association lists. If
(call-with-input-file (basename inputs-file)
json->scm)
(read-yaml-file (basename inputs-file)))))))
+
+(define (coerce-type val type)
+ "Coerce @var{val} to @var{type}."
+ ;; This function exists to handle YAML's type ambiguities.
+ (case type
+ ((boolean)
+ (cond
+ ((member val (list "true" "yes")) #t)
+ ((member val (list "false" "no")) #f)
+ (else (error "Unable to coerce value to type" val type))))
+ (else val)))
diff --git a/ravanan/workflow.scm b/ravanan/workflow.scm
index af720a8..989c711 100644
--- a/ravanan/workflow.scm
+++ b/ravanan/workflow.scm
@@ -157,17 +157,6 @@ requirements and hints of the step."
(list (subset-requirements parent-hints)
(subset-requirements step-hints)))))))
-(define (coerce-type val type)
- "Coerce @var{val} to @var{type}."
- ;; This function exists to handle YAML's type ambiguities.
- (case type
- ((boolean)
- (cond
- ((member val (list "true" "yes")) #t)
- ((member val (list "false" "no")) #f)
- (else (error "Unable to coerce value to type" val type))))
- (else val)))
-
(define (optional-input? input)
"Return @code{#t} if @var{input} is optional. Else, return @code{#f}."
;; Inputs that either have a default or accept null values are optional.